This repository has been archived by the owner on Dec 5, 2023. It is now read-only.
forked from danskernesdigitalebibliotek/dpl-design-system
-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (80 loc) · 2.92 KB
/
deployment.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Deployment
on:
push:
branches-ignore:
# Dependabot does not have permissions to create releases
- 'dependabot/**'
jobs:
deploy_release:
name: "Deploy release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- run: yarn install --frozen-lockfile
- name: Building
run: yarn css:build
- name: Bundling assets
run: ./bundle.sh
- name: Release with tag
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: dist.zip
- name: Release branch
if: startsWith(github.ref, 'refs/heads/')
uses: "marvinpinto/[email protected]"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
# Add prefix branch name to avoid duplicate git references.
automatic_release_tag: "release-${{ github.ref_name }}"
prerelease: true
title: ${{ github.ref_name }}
files: dist.zip
deploy_npm:
name: "Deploy NPM package"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: "https://npm.pkg.github.com"
scope: "@${{ github.repository_owner }}"
- run: yarn install --frozen-lockfile
- name: Building
run: yarn css:build
- name: Bundling assets
run: ./bundle.sh
- name: Modify package.json for local context
# Values in package.json must match the current GitHub repository to
# publish to it.
run: |
npm exec -- json -I -f package.json -e "this.name='@$GITHUB_REPOSITORY'"
npm exec -- json -I -f package.json -e "this.repository='https://github.com/$GITHUB_REPOSITORY'"
- name: Release branch
if: startsWith(github.ref, 'refs/heads/')
# Version 0.0.0-SHA is a schema that supports semantic versioning but
# should sink below proper versions.
# Output package.json to provide insight and help debugging
# Using branch names as tags allows other projects to track unreleased
# development.
run: |
NPM_TAG_NAME=$(echo $GITHUB_REF_NAME | tr -d [:space:] | tr -C [:alnum:] -)
npm version 0.0.0-$GITHUB_SHA --no-git-tag-version
echo $NPM_TAG_NAME
cat package.json
npm publish --tag $NPM_TAG_NAME
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release with tag
if: startsWith(github.ref, 'refs/tags/')
# The latest tag follows tagged versions to follow NPM conventions.
run: |
npm version $GITHUB_REF_NAME --no-git-tag-version
cat package.json
npm publish --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}