Fix goreleaser version #22
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
on: | |
push: | |
branches: | |
- master | |
name: Master Workflow - Test and release | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.16.x | |
- name: Install Node&Npm | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Retrieve new version | |
run: | | |
echo "::set-output name=TAG_NAME::$(cat main.go|grep app.Version|grep -Eo '[0-9.]{2,100}')" | |
id: version | |
- name: "Check releases notes" | |
uses: andstor/file-existence-action@v1 | |
with: | |
allow_failure: true | |
files: release-notes/${{ steps.version.outputs.TAG_NAME }}.md | |
- uses: actions/cache@v2 | |
with: | |
# In order: | |
# * Module download cache | |
# * Build cache (Linux) | |
# * Build cache (Mac) | |
# * Build cache (Windows) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
~/Library/Caches/go-build | |
%LocalAppData%\go-build | |
/home/runner/.cache/firebase/emulators | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Install firebase | |
run: make install-firebase | |
- name: Build | |
run: make build | |
- name: Run emulator and test | |
run: make test | |
release: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.15 | |
- name: Retrieve new version | |
run: | | |
echo "::set-output name=TAG_NAME::$(cat main.go|grep app.Version|grep -Eo '[0-9.]{2,100}')" | |
id: version | |
- name: Tag | |
run: | | |
tag=${{ steps.version.outputs.TAG_NAME }} | |
message='Release ${{ steps.version.outputs.TAG_NAME }}' | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
git tag -a "${tag}" -m "${message}" | |
git push origin "${tag}" | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v2 | |
with: | |
distribution: goreleaser | |
version: v1.12.3 | |
args: release --rm-dist --release-notes=release-notes/${{ steps.version.outputs.TAG_NAME }}.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
snap-release-job: | |
needs: test | |
runs-on: ubuntu-18.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install Snapcraft | |
uses: samuelmeuli/action-snapcraft@v1 | |
with: | |
snapcraft_token: ${{ secrets.snapcraft_token }} | |
use_lxd: true | |
- name: Build snap | |
run: sg lxd -c 'snapcraft --use-lxd' && snapcraft upload --release=stable fuego_*.snap |