Merge pull request #69 from axone-protocol/dependabot/go_modules/go/c… #82
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: Publish | |
on: | |
push: | |
branches: [main] | |
tags: ["v*"] | |
concurrency: | |
group: publish-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
uses: ./.github/workflows/lint.yml | |
build: | |
uses: ./.github/workflows/build.yml | |
schema-matrix: | |
runs-on: ubuntu-22.04 | |
outputs: | |
schema: ${{ steps.set-matrix.outputs.schema }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: set-matrix | |
run: echo "::set-output name=schema::$(ls schema/ | jq -R -s -c 'split("\n")[:-1] | map(select(test(".json$") | not))')" | |
publish-npm-package: | |
runs-on: ubuntu-22.04 | |
needs: | |
- lint | |
- build | |
- schema-matrix | |
strategy: | |
matrix: | |
registry: | |
- url: "https://npm.pkg.github.com" | |
auth-token-secret: GITHUB_TOKEN | |
- url: "https://registry.npmjs.org" | |
auth-token-secret: NPM_PUBLIC_REGISTRY_TOKEN | |
schema: ${{ fromJson(needs.schema-matrix.outputs.schema) }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up context | |
id: project_context | |
uses: FranzDiebold/[email protected] | |
- name: Setup node environment (for publishing) | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.12 | |
registry-url: ${{ matrix.registry.url }} | |
scope: "@axone" | |
- name: Setup Go environment | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
cache: true | |
cache-dependency-path: | | |
**/go.sum | |
**/go.mod | |
- name: Install Mage | |
run: go install github.com/magefile/[email protected] | |
- name: Publish | |
run: | | |
mage -v publish:ts ${{ matrix.schema }} $GITHUB_REF | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets[matrix.registry.auth-token-secret] }} | |
create_release: | |
runs-on: ubuntu-22.04 | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: | |
- lint | |
- build | |
steps: | |
- name: Create release | |
uses: softprops/action-gh-release@v2 | |
with: | |
body: Schema changelog avalaible on [contract repository](https://github.com/axone-protocol/contracts/blob/${{ github.ref_name }}/CHANGELOG.md). |