Skip to content

Commit 0fd4b04

Browse files
committed
Push image after e2e-tests
1 parent 0ec61b6 commit 0fd4b04

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/ci-cd.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,46 @@ jobs:
114114
output="${{steps.run.outputs.result}}"
115115
[[ "$output" != "$expected" ]] && echo "::error::❌ Expected '$expected', got '$output'" && exit 1
116116
echo "✅ Test passed, outputs.result: ${{toJSON(steps.run.outputs.result)}}"
117+
118+
push:
119+
runs-on: ubuntu-latest
120+
needs: [ version, build, e2e-tests ]
121+
122+
permissions:
123+
packages: write
124+
125+
steps:
126+
- uses: actions/checkout@v3
127+
- uses: docker/setup-buildx-action@v3
128+
- uses: docker/login-action@v3
129+
with:
130+
registry: ghcr.io
131+
username: ${{ github.actor }}
132+
password: ${{ github.token }}
133+
- uses: docker/metadata-action@v5
134+
id: meta
135+
with:
136+
images: ghcr.io/${{ github.repository }}
137+
tags: |
138+
type=ref,event=branch,prefix=branch-,enable=${{ github.ref != 'refs/heads/main' }}
139+
type=semver,pattern=v{{version}},value=${{needs.version.outputs.semver}},enable=${{ github.ref == 'refs/heads/main' && needs.version.outputs.exists == 'false' }}
140+
type=semver,pattern=v{{major}}.{{minor}},value=${{needs.version.outputs.semver}},enable=${{ github.ref == 'refs/heads/main' && needs.version.outputs.exists == 'false' }}
141+
type=semver,pattern=v{{major}},value=${{needs.version.outputs.semver}},enable=${{ github.ref == 'refs/heads/main' && needs.version.outputs.exists == 'false' && !startsWith(needs.version.outputs.semver, '0') }}
142+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' && needs.version.outputs.exists == 'false' }}
143+
type=sha,format=long
144+
- name: Download artifact
145+
uses: actions/download-artifact@v3
146+
with:
147+
name: elixir_script
148+
path: /tmp
149+
- name: Load image
150+
run: docker load --input /tmp/elixir_script.tar
151+
- name: Tag image
152+
run: |
153+
echo "${{ steps.meta.outputs.tags }}" | while read -r tag; do
154+
echo "Processing tag: $tag"
155+
docker tag elixir_script:test "$tag"
156+
done
157+
- name: Push image
158+
if: ${{ github.ref == 'refs/heads/main' && needs.version.outputs.exists == 'false' }}
159+
run: docker push --all-tags ghcr.io/gaggle/elixir_script

0 commit comments

Comments
 (0)