-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Github workflow to push to github packages for docker
- Loading branch information
1 parent
8400352
commit 3fb975d
Showing
2 changed files
with
28 additions
and
10 deletions.
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 |
---|---|---|
|
@@ -23,11 +23,11 @@ jobs: | |
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build and push | ||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
|
@@ -36,7 +36,16 @@ jobs: | |
tags: ${{ github.repository }}:latest | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
|
||
- name: Push to GitHub Packages | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:latest | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
|
||
deploy: | ||
needs: [test, build] | ||
runs-on: ubuntu-latest | ||
|
@@ -54,7 +63,7 @@ jobs: | |
echo "::set-output name=TAG::$(git tag --points-at HEAD)" | ||
echo "::set-output name=GIT_SHA::$(git rev-parse HEAD)" | ||
echo "::set-output name=GIT_SHA_SHORT::$(git rev-parse --short HEAD)" | ||
echo "::set-output name=MESSAGE::$(git log --format=%B -n 1 ${{ github.event.after }})" | ||
echo "::set-output name=MESSAGE::$(git log --format=%B -n 1 ${{ github.event.after }})" | ||
id: extract_variables | ||
|
||
- name: Checkout terraform config repo | ||
|
@@ -73,7 +82,7 @@ jobs: | |
tar -xzvf dockerize-linux-amd64-v0.6.0.tar.gz | ||
rm dockerize-linux-amd64-v0.6.0.tar.gz | ||
./dockerize -template stage/services/profiles/_volpino.auto.tfvars.tmpl:stage/services/profiles/_volpino.auto.tfvars | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add stage/services/profiles/_volpino.auto.tfvars | ||
|
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 |
---|---|---|
|
@@ -22,15 +22,15 @@ jobs: | |
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Get git tag | ||
run: | | ||
echo "::set-output name=GIT_TAG::$(git tag --points-at HEAD)" | ||
id: set_git_vars | ||
- name: Build and push | ||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
|
@@ -39,7 +39,16 @@ jobs: | |
tags: ${{ github.repository }}:${{ steps.set_git_vars.outputs.GIT_TAG }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
|
||
- name: Push to GitHub Packages | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:${{ steps.set_git_vars.outputs.GIT_TAG }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
|
||
deploy: | ||
needs: [test, build] | ||
runs-on: ubuntu-latest | ||
|
@@ -55,7 +64,7 @@ jobs: | |
echo "::set-output name=BRANCH::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" | ||
echo "::set-output name=TAG::$(git tag --points-at HEAD)" | ||
echo "::set-output name=GIT_SHA::$(git rev-parse HEAD)" | ||
echo "::set-output name=GIT_SHA_SHORT::$(git rev-parse --short HEAD)" | ||
echo "::set-output name=GIT_SHA_SHORT::$(git rev-parse --short HEAD)" | ||
id: extract_variables | ||
|
||
- name: Checkout terraform config repo | ||
|
@@ -74,7 +83,7 @@ jobs: | |
tar -xzvf dockerize-linux-amd64-v0.6.0.tar.gz | ||
rm dockerize-linux-amd64-v0.6.0.tar.gz | ||
./dockerize -template prod-eu-west/services/profiles/_volpino.auto.tfvars.tmpl:prod-eu-west/services/profiles/_volpino.auto.tfvars | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add prod-eu-west/services/profiles/_volpino.auto.tfvars | ||
|