Skip to content

Commit 1e22995

Browse files
authored
fix: roll back to the separate build workflow (#159)
> ⨯ release failed after 379.81s error=docker images: failed to publish > artifacts: failed to push ghcr.io/envelope-zero/backend:v0.20.5: > exit status 1: The push refers to repository [ghcr.io/envelope-zero/backend] > 9c19cdb2b096: Preparing > denied: unauthenticated: User cannot be authenticated with the token provided.
1 parent c0d1082 commit 1e22995

File tree

3 files changed

+65
-10
lines changed

3 files changed

+65
-10
lines changed

.github/workflows/build.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build and release OCI image
2+
3+
on:
4+
push:
5+
tags:
6+
- "**"
7+
pull_request:
8+
branches:
9+
- "main"
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: ${{ github.repository }}
14+
15+
jobs:
16+
build-and-push-image:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Check if image should be pushed
24+
id: push_check
25+
run: |
26+
if [[ "${{ github.ref }}" == refs/tags/* || "${{ github.ref }}" == "refs/heads/main" ]]; then
27+
echo "::set-output name=push::true"
28+
else
29+
echo "::set-output name=push::false"
30+
fi
31+
32+
- name: Checkout repository
33+
uses: actions/checkout@v3
34+
35+
- name: Log in to the Container registry
36+
uses: docker/[email protected]
37+
with:
38+
registry: ${{ env.REGISTRY }}
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
42+
- name: Extract metadata (tags, labels) for Docker
43+
id: meta
44+
uses: docker/[email protected]
45+
with:
46+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
47+
48+
- name: Build and push Docker image
49+
uses: docker/[email protected]
50+
with:
51+
context: .
52+
push: ${{ steps.push_check.outputs.push }}
53+
tags: ${{ steps.meta.outputs.tags }}
54+
labels: ${{ steps.meta.outputs.labels }}
55+
build-args: |
56+
VERSION=${{ github.ref_name }}

.github/workflows/go-test-and-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ on:
88
tags:
99
- "*"
1010

11-
permissions:
12-
packages: write
11+
#permissions:
12+
# packages: write
1313

1414
jobs:
1515
go-test:

.goreleaser.yaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ changelog:
2424
exclude:
2525
- "^docs:"
2626
- "^test:"
27-
28-
dockers:
29-
- dockerfile: Dockerfile.goreleaser
30-
image_templates:
31-
- "ghcr.io/envelope-zero/backend:{{ .Tag }}"
32-
- "ghcr.io/envelope-zero/backend:v{{ .Major }}"
33-
- "ghcr.io/envelope-zero/backend:v{{ .Major }}.{{ .Minor }}"
34-
- "ghcr.io/envelope-zero/backend:latest"
27+
# dockers:
28+
# - dockerfile: Dockerfile.goreleaser
29+
# image_templates:
30+
# - "ghcr.io/envelope-zero/backend:{{ .Tag }}"
31+
# - "ghcr.io/envelope-zero/backend:v{{ .Major }}"
32+
# - "ghcr.io/envelope-zero/backend:v{{ .Major }}.{{ .Minor }}"
33+
# - "ghcr.io/envelope-zero/backend:latest"

0 commit comments

Comments
 (0)