Update README.md #39
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: build | |
on: | |
push: | |
branches: | |
- main | |
- 'release/**' | |
pull_request: | |
branches: | |
- main | |
- 'release/**' | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.18 | |
- name: Build | |
run: | | |
export VERSION=`echo $GITHUB_REF | sed -e "s/refs\/heads\///g" -e "s/release\///g"` | |
# This should actually be set using: https://www.digitalocean.com/community/tutorials/using-ldflags-to-set-version-information-for-go-applications | |
sed -i "s/0.0.0/${VERSION}/g" src/version.go | |
make install | |
make test | |
- name: Create Github Release and Tag | |
if: github.repository_owner == 'Authress' && github.ref != 'refs/heads/main' && github.event_name == 'push' | |
run: | | |
git tag v${GITHUB_REF/refs\/heads\/release\//}.$GITHUB_RUN_NUMBER -f | |
git push origin v${GITHUB_REF/refs\/heads\/release\//}.$GITHUB_RUN_NUMBER | |
goreleaser: | |
if: github.repository_owner == 'Authress' && github.ref != 'refs/heads/main' && github.event_name == 'push' | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Unshallow | |
run: git fetch --prune --unshallow | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.18 | |
- name: Import GPG key | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@e37acbdf6e46d8be3f11008297e2964d5f68adef | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
- name: List keys | |
run: gpg -K | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v2 | |
with: | |
version: latest | |
args: release --clean | |
env: | |
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |