ci: snap: ldflags weren't picked up #44
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: Go | |
on: | |
push: | |
branches: | |
- dev | |
tags: | |
- v* | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.21 | |
- name: Install packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgtk-3-dev xvfb gettext | |
- name: Prepare | |
run: | | |
go generate | |
go mod download | |
- name: Verify format | |
run: test `gofmt -l . | wc -l` = 0 | |
- name: Test | |
run: | | |
export DISPLAY=:99.0 | |
sudo /usr/bin/Xvfb $DISPLAY &>/dev/null & | |
go test -v ./... | |
deploy: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.21 | |
- name: Install packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgtk-3-dev gettext | |
- name: Verify GoReleaser config | |
uses: goreleaser/goreleaser-action@v4 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: check | |
- name: Make a release (tag only) | |
if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') | |
uses: goreleaser/goreleaser-action@v4 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build snap | |
# This must run AFTER goreleaser has built the app | |
id: snap | |
uses: snapcore/action-build@v1 | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: | | |
dist | |
${{ steps.snap.outputs.snap }} | |
- name: Publish dev snap to edge channel | |
if: github.ref_type == 'branch' && github.ref == 'refs/heads/dev' | |
uses: snapcore/action-publish@v1 | |
env: | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_LOGIN }} | |
with: | |
snap: ${{ steps.snap.outputs.snap }} | |
release: edge | |
- name: Publish snap to stable channel (tag only) | |
if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') | |
uses: snapcore/action-publish@v1 | |
env: | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_LOGIN }} | |
with: | |
snap: ${{ steps.snap.outputs.snap }} | |
release: stable |