Skip to content

Commit

Permalink
Add GH action for goreleaser (#142)
Browse files Browse the repository at this point in the history
* Add GH action for goreleaser

* Add dockerhub login

* Add `build only` for non-publishable releases

* Consistent goreleaser commands

* Add GHCR login

* Rename workflow to `goreleaser`
  • Loading branch information
RonnyLV authored May 22, 2024
1 parent 5a1a3db commit 13cabe7
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: goreleaser

on:
pull_request:
push:
# run only against tags
tags:
- "*"

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Login to Github Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v4
-
name: Run GoReleaser build only
uses: goreleaser/goreleaser-action@v5
if: "!startsWith(github.ref, 'refs/tags/')"
with:
distribution: goreleaser
version: '~> v1'
args: release --clean --skip-publish --skip-validate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Run GoReleaser release and publish
uses: goreleaser/goreleaser-action@v5
if: startsWith(github.ref, 'refs/tags/')
with:
distribution: goreleaser
version: '~> v1'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 13 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,16 @@ docker_manifests:
image_templates:
- "ghcr.io/lokalise/lokalise-cli-2:{{ .Tag }}-arm64v8"
- "ghcr.io/lokalise/lokalise-cli-2:{{ .Tag }}-amd64"

release:
github:
owner: lokalise
name: lokalise-cli-2-go
draft: true
replace_existing_draft: true
replace_existing_artifacts: true
target_commitish: "{{ .Commit }}"
prerelease: auto
make_latest: true
mode: append
name_template: "Release {{ .Tag }}"

0 comments on commit 13cabe7

Please sign in to comment.