-
Notifications
You must be signed in to change notification settings - Fork 42
103 lines (89 loc) · 2.89 KB
/
release.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
94
95
96
97
98
99
100
101
102
103
name: Release
on:
push:
branches:
- main
workflow_dispatch:
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
build:
name: "Release packages"
if: ${{!contains(github.event.head_commit.message, '[ci skip]')}}
runs-on: ubuntu-latest
permissions:
id-token: "write"
contents: "write"
packages: "write"
pull-requests: "write"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: "20"
cache: yarn
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Restore cache
uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-prod-${{ github.sha }}
restore-keys: |
${{ runner.os }}-prod
- name: Install dependencies
run: yarn
- name: Create release Pull Request or publish to NPM
id: changesets
uses: changesets/action@v1
with:
version: yarn version
publish: yarn release
createGithubReleases: false
env:
NPM_TOKEN: ${{ secrets.NPM_AUTOMATION }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTOMATION }}
- name: Creating .npmrc
run: |
cat << EOF > "$HOME/.npmrc"
@navikt:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.GIT_REPO }}
- name: Publish to GPR
if: steps.changesets.outputs.published == 'true'
id: changesets-gpr
uses: changesets/action@v1
with:
publish: yarn changeset publish
createGithubReleases: false
env:
NPM_TOKEN: ${{ secrets.NPM_AUTOMATION }}
GITHUB_TOKEN: ${{ secrets.GIT_REPO }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTOMATION }}
- name: Generate icon.zip
if: steps.changesets.outputs.published == 'true'
run: yarn zip:icons
- name: Upload updated icon.zip to NAV CDN
if: steps.changesets.outputs.published == 'true'
uses: navikt/frontend/actions/cdn-upload/v1@main
with:
cdn-team-name: aksel
source: ./@navikt/aksel-icons/aksel-icons.zip
destination: "/icons/zip"
- name: Get @navikt/ds-css version
run: |
VERSION=$(yarn css:get-version)
echo "version=$VERSION" >> $GITHUB_ENV
echo "Version of @navikt/ds-css: ${{ env.version }}"
- name: Upload CSS to NAV CDN
if: steps.changesets.outputs.published == 'true'
uses: navikt/frontend/actions/cdn-upload/v1@main
with:
cdn-team-name: aksel
source: ./@navikt/core/css/dist/version/${{env.version}}
destination: "@navikt/ds-css"