Version Packages (#3181) #1365
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
paths: | |
- ".changeset/**" | |
- "@navikt/**" | |
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@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
cache: yarn | |
- name: set-env for yarn install to @navikt scope | |
shell: bash | |
run: echo "NPM_AUTH_TOKEN=${{ secrets.READER_TOKEN }}" >> $GITHUB_ENV | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- name: Install dependencies | |
run: yarn | |
- name: Create release Pull Request or publish to NPM | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
version: yarn create-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: nais/deploy/actions/cdn-upload/v2@master | |
with: | |
team: aksel | |
source: ./@navikt/aksel-icons/aksel-icons.zip | |
destination: "/icons/zip" | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | |
- 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: nais/deploy/actions/cdn-upload/v2@master | |
with: | |
team: aksel | |
source: ./@navikt/core/css/dist/version/${{env.version}} | |
destination: "@navikt/ds-css" | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} |