-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): publish the staging Docker image with goreleaser (#179)
Publish the staging Docker image (ghcr.io/italia/developers-italia-api:main) when pushing to main.
- Loading branch information
Showing
3 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Push the staging Docker image (ghcr.italia/developers-italia-api:main) | ||
# on updates to main. | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
permissions: | ||
# To push Docker images to GitHub | ||
packages: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18.x | ||
- | ||
uses: actions/checkout@v2 | ||
with: | ||
# All history, required for goreleaser | ||
fetch-depth: 0 | ||
- | ||
# FIXME: goreleaser should already take care of the login | ||
# (see https://github.com/goreleaser/goreleaser/blame/02a3486d4ba59505113a57b438ae567351ed3dab/scripts/entrypoint.sh#L17) | ||
# but it doesn't work for some reason. | ||
run: echo "$GITHUB_TOKEN" | docker login ghcr.io -u docker --password-stdin | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- | ||
# Tag with a temporary valid semantic version. This is required by goreleaser. | ||
run: git tag $(git describe --tags --abbrev=0)-main-$(git rev-parse --short HEAD) | ||
|
||
- | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: v1.9.2 | ||
args: release --config .goreleaser.staging.yaml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Goreleases configuration for staging builds, just builds and pushes | ||
# the Docker image for the main branch. | ||
# | ||
# Make sure to check the documentation at https://goreleaser.com | ||
|
||
# Don't create a GitHub release | ||
release: | ||
disable: true | ||
|
||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
ldflags: | ||
- -s -w | ||
goos: | ||
- linux | ||
dockers: | ||
- | ||
dockerfile: Dockerfile.goreleaser | ||
image_templates: | ||
- "ghcr.io/italia/developers-italia-api:main" |
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