fx/.github/workflows/release.yml
2022-04-25 21:22:51 +02:00

76 lines
1.7 KiB
YAML

name: release
on:
release:
types:
- created
jobs:
commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: master
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Get Version
run: echo "RELEASE_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- 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
git add version.go snap/snapcraft.yaml
git config --global user.email "github-actions@github.com"
git config --global user.name "github-actions"
git commit -m "Release RELEASE_VERSION"
git tag -a "$RELEASE_VERSION" -m "Release $RELEASE_VERSION" --force
git push --follow-tags --force
- name: Test
run: go test -v ./...
binary:
needs: [commit]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Build and Upload
env:
FORCE_COLOR: 3
GITHUB_TOKEN: ${{ secrets.MY_TOKEN }}
run: npx zx .github/workflows/release.mjs
snap:
needs: [commit]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- uses: snapcore/action-build@v1
id: build
- uses: snapcore/action-publish@v1
with:
store_login: ${{ secrets.STORE_LOGIN }}
snap: ${{ steps.build.outputs.snap }}
release: stable