Skip to content

Commit 18b41e8

Browse files
committed
attempt publish... hopefully
1 parent ab95095 commit 18b41e8

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

.github/workflows/docker.yml

+25-9
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,30 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
12+
- name: Parse Commit SHA to Container Tag
13+
run: echo "CONTAINER_TAG=main_$(git log --pretty=format:'%h' -n 1)" >> $GITHUB_ENV
1214
- name: Build container
13-
run: docker buildx build -f Dockerfile . -t UND-ACM/hello:latest
15+
run: docker buildx build -f Dockerfile . -t UND-ACM/demo-ci-docker:latest -t UND-ACM/demo-ci-docker:main_${{ env.CONTAINER_TAG }}
1416
- name: Export container
15-
run: docker save UND-ACM/hello:latest | gzip - > ${{ github.workflow_sha }}.tar.gz
17+
run: docker save UND-ACM/demo-ci-docker:latest | gzip - > main_${{ env.CONTAINER_TAG }}.tar.gz
1618
- uses: actions/upload-artifact@v4
1719
name: Upload artifact
1820
with:
19-
path: '${{ github.workflow_sha }}.tar.gz'
20-
name: 'container_tarball_${{ github.workflow_sha }}'
21+
path: 'main_${{ env.CONTAINER_TAG }}.tar.gz'
22+
name: 'container_tarball_${{ env.CONTAINER_TAG }}'
2123
test:
22-
name: Test container functionality
24+
name: Test container health
2325
runs-on: ubuntu-latest
2426
needs: compile
2527
steps:
2628
- uses: actions/download-artifact@v4
2729
name: Download workflow artifact
2830
with:
29-
name: 'container_tarball_${{ github.workflow_sha }}'
31+
name: 'container_tarball_${{ env.CONTAINER_TAG }}'
3032
- name: Load image
31-
run: gunzip -c ${{ github.workflow_sha }}.tar.gz | docker load
33+
run: gunzip -c main_${{ env.CONTAINER_TAG }}.tar.gz | docker load
3234
- name: Spin up container
33-
run: docker run -d --name helloworld UND-ACM/hello:latest
35+
run: docker run -d --name helloworld UND-ACM/demo-ci-docker:main_${{ env.CONTAINER_TAG }}
3436
- name: Await healthy or failed status
3537
run: |
3638
while(true); do
@@ -48,4 +50,18 @@ jobs:
4850
echo "Unknown status, uh oh!";
4951
exit 1;
5052
fi
51-
done
53+
done
54+
publish:
55+
runs-on: ubuntu-latest
56+
needs: test
57+
steps:
58+
- uses: actions/download-artifact@v4
59+
name: Download workflow artifact
60+
with:
61+
name: 'container_tarball_${{ env.CONTAINER_TAG }}'
62+
- name: Load image
63+
run: gunzip -c main_${{ env.CONTAINER_TAG }}.tar.gz | docker load
64+
- name: Log In to Registry
65+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
66+
- name: Publish Image
67+
run: docker push --all-tags ghcr.io/UND-ACM/demo-ci-docker

0 commit comments

Comments
 (0)