Merge pull request #214 from nais/changeset-release/main #78
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: | |
branches: | |
- main | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
release: | |
permissions: | |
contents: "write" | |
id-token: "write" | |
pull-requests: "write" | |
outputs: | |
actual_release: ${{ steps.prerelease.outputs.ACTUAL_RELEASE }} | |
published: ${{ steps.changesets.outputs.published }} | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install asdf | |
uses: asdf-vm/actions/setup@v3 | |
- name: asdf cache | |
id: asdf-cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.asdf/ | |
key: ${{ runner.os }}-${{ hashFiles('**/.tool-versions') }} | |
- name: Install CD tools from .tool-versions | |
if: steps.asdf-cache.outputs.cache-hit != 'true' | |
uses: asdf-vm/actions/install@v3 | |
- id: "auth" | |
name: "Authenticate to Google Cloud" | |
uses: "google-github-actions/auth@v2" # ratchet:google-github-actions/auth@v2 | |
with: | |
workload_identity_provider: "${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }}" | |
service_account: "gh-ds-svelte-community@nais-io.iam.gserviceaccount.com" | |
token_format: "access_token" | |
- run: bun install | |
- run: bun run gar-login && bun run build:libs | |
- name: Create Release Pull Request | |
uses: changesets/action@v1 | |
id: changesets | |
with: | |
createGithubReleases: true | |
publish: bun run release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Check if pre-release" | |
id: "prerelease" | |
# Use jq to check if the @nais/ds-svelte-community package is a pre-release | |
run: | | |
# export ACTUAL_RELEASE=$(echo "${{ steps.changesets.outputs.publishedPackages }}" | jq '.[] | select(.name == "@nais/ds-svelte-community") | .version | contains("-next.") | not') | |
export ACTUAL_RELEASE=true | |
echo "ACTUAL_RELEASE=$ACTUAL_RELEASE" >> $GITHUB_OUTPUT |