release #369
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: | |
workflow_run: | |
workflows: ["Github workflow test"] | |
types: [completed] | |
workflow_dispatch: | |
push: | |
tags: | |
- "v*.*.*" | |
jobs: | |
build-and-push-image: | |
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@master | |
with: | |
registry: ghcr.io | |
username: davidkhala | |
password: ${{ secrets.TWGC_DAVIDKHALA }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@master | |
with: | |
images: ghcr.io/hyperledger-twgc/tape | |
tags: | | |
type=ref,event=tag | |
- if: github.ref == 'refs/heads/master' | |
name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64,linux/s390x | |
push: true | |
tags: ghcr.io/hyperledger-twgc/tape | |
labels: ${{ steps.meta.outputs.labels }} | |
build-and-release-binary: | |
if: startsWith(github.event.ref, 'refs/tags/') | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- run: GOOS=$(go env GOOS) GOARCH=$(go env GOARCH) make tape | |
shell: bash | |
- run: cp tape tape-${{runner.os}}-${{runner.arch}} | |
- name: Release | |
uses: softprops/action-gh-release@master | |
with: | |
files: | | |
tape-${{runner.os}}-${{runner.arch}} | |
config.yaml | |
- name: Generate SBOM | |
uses: anchore/sbom-action@v0.15.11 | |
with: | |
path: ./ | |
artifact-name: tape-${{ steps.meta.outputs.labels }}.json | |
output-file: ./tape-${{ steps.meta.outputs.labels }}.spdx.json | |
- name: Attach SBOM to release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: tape-${{ steps.meta.outputs.labels }} | |
files: ./tape-${{ steps.meta.outputs.labels }}.spdx.json |