diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..328a63f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,61 @@ +name: Release + +on: + push: + tags: + - 'v*' + workflow_dispatch: + inputs: + tag: + description: 'Tag to release (e.g. v0.1.0). The tag must already exist.' + required: true + type: string + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Resolve ref + id: ref + run: | + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "ref=${{ inputs.tag }}" >> "$GITHUB_OUTPUT" + echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT" + else + echo "ref=${{ github.ref }}" >> "$GITHUB_OUTPUT" + echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT" + fi + + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ steps.ref.outputs.ref }} + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + check-latest: true + + - name: Build all targets + run: make build-all + + - name: Generate SHA256SUMS + working-directory: dist + run: | + sha256sum bootstrap_environment-* > SHA256SUMS + cat SHA256SUMS + + - name: Create release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.ref.outputs.tag }} + name: ${{ steps.ref.outputs.tag }} + generate_release_notes: true + fail_on_unmatched_files: true + files: | + dist/bootstrap_environment-* + dist/SHA256SUMS