Skip to content

Version Packages (#2169) #720

Version Packages (#2169)

Version Packages (#2169) #720

Workflow file for this run

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: 16.13.0
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"