Skip to content

Commit

Permalink
Separate CI "release" workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
wi1dcard committed Mar 15, 2024
1 parent a1831f9 commit df09abd
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 22 deletions.
24 changes: 2 additions & 22 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: CI
on:
push:
tags: ["*"]
branches: ["master"]
pull_request:
branches: ["master"]
Expand Down Expand Up @@ -58,25 +57,18 @@ jobs:
make test >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
build-release:
name: Build and Release
build:
name: Build
runs-on: ubuntu-latest
permissions:
# Allow creating releases
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-go@v5
with:
go-version-file: go.mod

- run: |
go version
go get
- run: make build

- name: Extract short commit SHA
Expand All @@ -93,15 +85,3 @@ jobs:
with:
name: fingerproxy_linux_amd64_${{ steps.short-sha.outputs.value }}
path: bin/fingerproxy_linux_amd64

- name: Release
if: startsWith(github.ref, 'refs/tags/v')
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG=$(git describe --tags --abbrev=0 HEAD)
LAST_TAG=$(git describe --tags --abbrev=0 HEAD^ || true)
[[ -n $LAST_TAG ]] && RANGE=$LAST_TAG..HEAD || RANGE=HEAD
RELEASE_NOTES=$(git log "$RANGE" --oneline --decorate)
gh release create --notes "$RELEASE_NOTES" "$TAG" bin/*
37 changes: 37 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release
on:
push:
tags: ["*"]

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
# allow creating releases
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-go@v5
with:
go-version-file: go.mod

- run: |
go version
go get
- run: make build

- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG=$(git describe --tags --abbrev=0 HEAD)
LAST_TAG=$(git describe --tags --abbrev=0 HEAD^ || true)
[[ -n $LAST_TAG ]] && RANGE=$LAST_TAG..HEAD || RANGE=HEAD
RELEASE_NOTES=$(git log "$RANGE" --oneline --decorate)
gh release create --notes "$RELEASE_NOTES" "$TAG" bin/*

0 comments on commit df09abd

Please sign in to comment.