Release next #68
Workflow file for this run
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 | |
run-name: Release ${{ github.ref_name }} | |
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_ENV | |
elif ${{ github.event_name == 'push' }} | |
then | |
echo "Set branch to '${{ github.ref_name }}' for push trigger" | |
echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV | |
else | |
echo "Unhandled trigger" | |
fi | |
- name: Assign channel | |
id: assign-channel | |
shell: bash | |
run: | | |
if ${{ env.BRANCH == 'main' }} | |
then | |
echo "Set channel to 'latest' for main branch" | |
echo "CHANNEL=latest" >> $GITHUB_ENV | |
elif ${{ github.event_name == 'push' }} | |
then | |
echo "Set channel to '${{ env.BRANCH }}'" | |
echo "CHANNEL=${{ env.BRANCH }}" >> $GITHUB_ENV | |
else | |
echo "Unhandled trigger" | |
fi | |
semantic-release: | |
needs: instantiate | |
runs-on: ubuntu-latest | |
outputs: | |
new_version: ${{ steps.semantic.outputs.new_release_version }} | |
steps: | |
- name: With branch | |
shell: bash | |
run: | | |
echo ${{ needs.instantiate.outputs.branch }} | |
- 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 ${{ steps.semantic.outputs.new_release_version }} | |
go-releaser: | |
needs: | |
- semantic-release | |
runs-on: ubuntu-latest | |
steps: | |
- name: With version | |
shell: bash | |
run: | | |
echo ${{ needs.semantic-release.outputs.new_version }} | |
- 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: | |
- semantic-release | |
- instantiate | |
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 }} | |
- 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 repository | |
uses: actions/checkout@v3 | |
with: | |
ref: v${{ needs.semantic-release.outputs.new_version }} | |
fetch-depth: 0 | |
- 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: "Update NPM version ${{ matrix.package }}" | |
uses: reedyuk/[email protected] | |
with: | |
version: ${{ needs.semantic-release.outputs.new_version }} | |
package: ./packages/${{ matrix.package }} | |
- 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 }} |