v1.11.1 #92
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: Generate binaries | |
on: | |
release: | |
types: | |
- created | |
permissions: | |
contents: write | |
jobs: | |
binaries: | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/goreleaser/goreleaser-cross:v1.18 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Fetch repo | |
run: git fetch --prune --unshallow | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: v1.19.x | |
- name: Release | |
uses: goreleaser/goreleaser-action@v4 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
file: ./cmd/api/Dockerfile | |
push: true | |
tags: textile/tableland:latest,textile/tableland:${{ github.event.release.tag_name }} | |
platforms: linux/amd64, linux/arm64 | |
js-release: | |
runs-on: ubuntu-latest | |
if: ${{ success() }} | |
needs: [binaries] | |
steps: | |
- run: echo 'validator_version ${{ github.event.release.tag_name }}' | |
- name: PR to publish this release via the npm package | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.TEXTILEIO_MACHINE_ACCESS_TOKEN }} | |
script: | | |
// This triggers the release-pr workflow in the js-validator repo | |
// which will create a pull request in that repo to update the binaries | |
// on npm with this release | |
try { | |
const ownerOrg = 'tablelandnetwork'; | |
// if the tag/release has a preceeding "v" we want to remove | |
// it and match standard symantics in the js ecosystem | |
let version = '${{ github.event.release.tag_name }}'; | |
if (/^v[0-9]/.test(version)) { | |
version = version.slice(1); | |
} | |
const options = { | |
owner: ownerOrg, | |
repo: 'js-validator', | |
workflow_id: 'validator-update-pr.yml', | |
ref: 'main', | |
inputs: { | |
validator_version: version | |
} | |
}; | |
console.log(options); | |
const response = await github.rest.actions.createWorkflowDispatch(options); | |
if (response.status !== 204) { | |
core.setFailed(`create workflow_dispatch received status code ${response.status}`); | |
} | |
} catch(err) { | |
console.log(err); | |
core.setFailed(err.message); | |
} |