-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish to DH and GHCR together & new maintainer (#48)
* Publishing to dockerhub and ghcr together Signed-off-by: Corey Caverly <corey.caverly@autodesk.com> * New Maintainer Signed-off-by: Corey Caverly <corey.caverly@autodesk.com> * Revving versions for release version Signed-off-by: Corey Caverly <corey.caverly@autodesk.com> --------- Signed-off-by: Corey Caverly <corey.caverly@autodesk.com> Co-authored-by: Corey Caverly <corey.caverly@autodesk.com>
- Loading branch information
1 parent
0265753
commit 5924837
Showing
4 changed files
with
60 additions
and
63 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# List of source code paths and code owners | ||
# common services & repos | ||
* @AgarFu @jnevelson @coreycaverly | ||
* @AgarFu @jnevelson @coreycaverly @kaosx5s |
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 |
---|---|---|
@@ -1,68 +1,58 @@ | ||
name: Docker | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
# GitHub recommends pinning actions to a commit SHA. | ||
# To get a newer version, you will need to update the SHA. | ||
# You can also reference a tag or branch, but the action may change without warning. | ||
|
||
name: Publish Docker image | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
env: | ||
# TODO: Change variable to your image's name. | ||
IMAGE_NAME: gordian | ||
types: [published] | ||
|
||
jobs: | ||
# Run tests. | ||
# See also https://docs.docker.com/docker-hub/builds/automated-testing/ | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Run tests | ||
run: | | ||
if [ -f docker-compose.test.yml ]; then | ||
docker-compose --file docker-compose.test.yml build | ||
docker-compose --file docker-compose.test.yml run sut | ||
else | ||
docker build . --file Dockerfile | ||
fi | ||
# Push image to GitHub Packages. | ||
# See also https://docs.docker.com/docker-hub/builds/ | ||
push: | ||
# Ensure test job passes before pushing image. | ||
needs: test | ||
|
||
push_to_registries: | ||
name: Push Docker image to multiple registries | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' | ||
|
||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Build image | ||
run: docker build . --file Dockerfile --tag $IMAGE_NAME | ||
|
||
- name: Log into GitHub Container Registry | ||
# TODO: Create a PAT with `read:packages` and `write:packages` scopes and save it as an Actions secret `CR_PAT` | ||
run: echo "${{ secrets.CR_PAT }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin | ||
|
||
- name: Push image to GitHub Container Registry | ||
run: | | ||
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | ||
# Change all uppercase to lowercase | ||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
# Strip git ref prefix from version | ||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
# Strip "v" prefix from tag name | ||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | ||
# Use Docker `latest` tag convention | ||
[ "$VERSION" == "master" ] && VERSION=latest | ||
echo IMAGE_ID=$IMAGE_ID | ||
echo VERSION=$VERSION | ||
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | ||
docker push $IMAGE_ID:$VERSION | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
with: | ||
username: ${{ secrets.DOCKERHUBUSER }} | ||
password: ${{ secrets.DOCKERHUBPASSWORD }} | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.CR_PAT }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: | | ||
argoprojlabs/gordian | ||
ghcr.io/${{ github.repository }} | ||
- name: Build and push Docker images | ||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
|
||
|
||
run: echo "${{ secrets.CR_PAT }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin |
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
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