2022-04-19 21:56:10 +00:00
|
|
|
name: release
|
|
|
|
|
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types:
|
|
|
|
- created
|
|
|
|
|
|
|
|
jobs:
|
2022-04-25 19:22:51 +00:00
|
|
|
commit:
|
2022-04-19 21:56:10 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2022-04-25 19:22:51 +00:00
|
|
|
with:
|
|
|
|
ref: master
|
2022-04-19 21:56:10 +00:00
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: 1.18
|
|
|
|
|
2022-04-25 14:22:42 +00:00
|
|
|
- name: Get Version
|
2022-04-20 21:08:59 +00:00
|
|
|
run: echo "RELEASE_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
|
|
|
|
|
2022-04-25 14:22:42 +00:00
|
|
|
- name: Update Version
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
sed -i "s/version = .*/version = \"${RELEASE_VERSION}\"/" version.go
|
|
|
|
sed -i "s/version: .*/version: ${RELEASE_VERSION}/" snap/snapcraft.yaml
|
2022-04-25 14:28:41 +00:00
|
|
|
git add version.go snap/snapcraft.yaml
|
2022-04-25 19:22:51 +00:00
|
|
|
git config --global user.email "github-actions@github.com"
|
2022-04-25 14:22:42 +00:00
|
|
|
git config --global user.name "github-actions"
|
|
|
|
git commit -m "Release RELEASE_VERSION"
|
2022-04-25 18:56:38 +00:00
|
|
|
git tag -a "$RELEASE_VERSION" -m "Release $RELEASE_VERSION" --force
|
2022-04-25 19:03:15 +00:00
|
|
|
git push --follow-tags --force
|
2022-04-25 14:22:42 +00:00
|
|
|
|
|
|
|
- name: Test
|
|
|
|
run: go test -v ./...
|
|
|
|
|
2022-04-25 14:43:14 +00:00
|
|
|
binary:
|
2022-04-25 19:22:51 +00:00
|
|
|
needs: [commit]
|
2022-04-25 14:43:14 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: 1.18
|
|
|
|
|
2022-04-25 18:49:04 +00:00
|
|
|
- name: Build and Upload
|
|
|
|
env:
|
|
|
|
FORCE_COLOR: 3
|
|
|
|
GITHUB_TOKEN: ${{ secrets.MY_TOKEN }}
|
|
|
|
run: npx zx .github/workflows/release.mjs
|
2022-04-25 14:22:42 +00:00
|
|
|
|
2022-04-25 14:43:14 +00:00
|
|
|
snap:
|
2022-04-25 19:22:51 +00:00
|
|
|
needs: [commit]
|
2022-04-25 14:43:14 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: 1.18
|
|
|
|
|
2022-04-25 18:49:04 +00:00
|
|
|
- uses: snapcore/action-build@v1
|
|
|
|
id: build
|
2022-04-25 14:22:42 +00:00
|
|
|
|
2022-04-25 18:49:04 +00:00
|
|
|
- uses: snapcore/action-publish@v1
|
|
|
|
with:
|
|
|
|
store_login: ${{ secrets.STORE_LOGIN }}
|
|
|
|
snap: ${{ steps.build.outputs.snap }}
|
|
|
|
release: stable
|