Skip to content

Release Keel

Release Keel #106

Workflow file for this run

name: Release Keel
on:
push:
branches:
- next
- prerelease
workflow_dispatch:
inputs:
branch:
required: true
type: choice
default: main
options:
- main
- next
- prerelease
jobs:
instantiate:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.assign-branch.outputs.BRANCH }}
channel: ${{ steps.assign-channel.outputs.CHANNEL }}
steps:
- name: Assign branch
id: assign-branch
shell: bash
run: |
if ${{ github.event_name == 'workflow_dispatch' }}
then
echo "Set branch to '${{ inputs.branch }}' for manual trigger"
echo "BRANCH=${{ inputs.branch }}" >> $GITHUB_OUTPUT
elif ${{ github.event_name == 'push' }}
then
echo "Set branch to '${{ github.ref_name }}' for push trigger"
echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_OUTPUT
else
echo "Unhandled trigger"
fi
- name: Assign channel
id: assign-channel
shell: bash
run: |
if ${{ steps.assign-branch.outputs.BRANCH == 'main' }}
then
echo "Set channel to 'latest' for main branch"
echo "CHANNEL=latest" >> $GITHUB_OUTPUT
else
echo "Set channel to '${{ steps.assign-branch.outputs.BRANCH }}'"
echo "CHANNEL=${{ steps.assign-branch.outputs.BRANCH }}" >> $GITHUB_OUTPUT
fi
semantic-release:
needs: instantiate
runs-on: ubuntu-latest
outputs:
is_published: ${{ steps.semantic.outputs.new_release_published }}
new_version: ${{ steps.semantic.outputs.new_release_version }}
steps:
- name: With branch
shell: bash
run: |
echo ${{ needs.instantiate.outputs.branch }}
- name: Instantiation check
if: ${{ needs.instantiate.outputs.branch == '' || needs.instantiate.outputs.channel == '' }}
uses: actions/github-script@v6
with:
script: |
core.setFailed('branch or channel not set')
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
ref: ${{ needs.instantiate.outputs.branch }}
fetch-depth: 0
- name: Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: 21.1.1
extra_plugins: |
@semantic-release/git
env:
GITHUB_TOKEN: ${{ secrets.KEEL_CI_SEMANTIC_RELEASE }}
- name: Version tag created
run: |
echo v${{ steps.semantic.outputs.new_release_version }}
go-releaser:
needs:
- semantic-release
if: ${{ needs.semantic-release.outputs.is_published }}
runs-on: ubuntu-latest
steps:
- name: With version
shell: bash
run: |
echo ${{ needs.semantic-release.outputs.new_version }}
- name: Instantiation check
if: ${{ needs.semantic-release.outputs.new_version == '' }}
uses: actions/github-script@v6
with:
script: |
core.setFailed('new_version not set')
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
ref: v${{ needs.semantic-release.outputs.new_version }}
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.20"
- name: Run goreleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.KEEL_CI_SEMANTIC_RELEASE }}
npm-publish:
needs:
- instantiate
- semantic-release
- go-releaser
if: ${{ needs.semantic-release.outputs.is_published }}
runs-on: ubuntu-latest
strategy:
matrix:
package:
[
"wasm",
"functions-runtime",
"testing-runtime",
"client-react",
"client-react-query",
"keel"
]
steps:
- name: With version and channel
shell: bash
run: |
echo ${{ needs.semantic-release.outputs.new_version }}
echo ${{ needs.instantiate.outputs.channel }}
- name: Instantiation check
if: ${{ needs.semantic-release.outputs.new_version == '' || needs.instantiate.outputs.channel == '' }}
uses: actions/github-script@v6
with:
script: |
core.setFailed('new_version or channel not set')
- uses: actions/setup-go@v3
with:
go-version: "1.20"
- uses: actions/setup-node@v3
with:
node-version: 18.12.1
token: ${{ secrets.NPM_TOKEN }}
- uses: pnpm/[email protected]
with:
version: 8.10.0
- name: Checkout
uses: actions/checkout@v3
with:
ref: v${{ needs.semantic-release.outputs.new_version }}
fetch-depth: 0
- name: "Update package.json version ${{ matrix.package }}"
uses: reedyuk/[email protected]
with:
version: ${{ needs.semantic-release.outputs.new_version }}
package: ./packages/${{ matrix.package }}
- name: Install Go deps
if: ${{ matrix.package == 'wasm' }}
run: go mod download
- name: Generate wasm binary
if: ${{ matrix.package == 'wasm' }}
run: make wasm
- name: Install ${{ matrix.package }} publish dependencies
working-directory: ./packages/${{ matrix.package }}
run: pnpm install --frozen-lockfile
- name: NPM Publish ${{ matrix.package }}
uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
tag: ${{ needs.instantiate.outputs.channel }}
package: ./packages/${{ matrix.package }}
dry-run: false
strategy: all
ignore-scripts: false
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}