Skip to content

Update workflow

Update workflow #19

Workflow file for this run

name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ linux, darwin, windows ]
arch: [ amd64, arm64 ]
exclude:
- os: windows
arch: arm64
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
- name: Build for ${{ matrix.os }} ${{ matrix.arch }}
working-directory: cmd/sops
run: |
env GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -v -o sops-${{ github.ref_name }}.${{ matrix.os }}.${{ matrix.arch }}
- name: Upload artifact ${{ matrix.os }}-${{ matrix.arch }}
uses: actions/upload-artifact@v2
with:
name: sops-${{ github.ref_name }}.${{ matrix.os }}.${{ matrix.arch }}
path: sops-*
prepare_release:
runs-on: ubuntu-latest
permissions: write-all
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
draft: false
prerelease: false
release:
needs: [ build, prepare_release ]
runs-on: ubuntu-latest
permissions: write-all
strategy:
matrix:
os: [ linux, darwin, windows ]
arch: [ amd64, arm64 ]
exclude:
- os: windows
arch: arm64
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: sops-${{ github.ref_name }}.${{ matrix.os }}.${{ matrix.arch }}
- name: Upload assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.prepare_release.outputs.upload_url }}
asset_path: ./sops-${{ github.ref_name }}.${{ matrix.os }}.${{ matrix.arch }}
asset_name: sops-${{ github.ref_name }}.${{ matrix.os }}.${{ matrix.arch }}
asset_content_type: application/octet-stream