generated from nicholaswilde/docker-template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: nιcнolaѕ wιlde <[email protected]>
- Loading branch information
1 parent
d6e13fd
commit 1885c10
Showing
3 changed files
with
22 additions
and
19 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 |
---|---|---|
|
@@ -28,7 +28,7 @@ on: | |
env: | ||
# How long to sleep before running the tests (gives the application time to start) | ||
GOSS_SLEEP: 30 | ||
|
||
jobs: | ||
prep: | ||
runs-on: ubuntu-latest | ||
|
@@ -41,14 +41,14 @@ jobs: | |
tag: ${{ steps.prep.outputs.version }}-ls${{ steps.prep.outputs.ls }} | ||
repo_name: ${{ steps.prep.outputs.repo_name }} | ||
date: ${{ steps.prep.outputs.date }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
# Define if tests and push should be run against which versions/platforms | ||
- name: Prepare | ||
id: prep | ||
id: prep | ||
run: | | ||
VERSION=$(cat ./VERSION) | ||
echo ::set-output name=version::${VERSION} | ||
|
@@ -74,7 +74,7 @@ jobs: | |
else | ||
echo ::set-output name=push::true | ||
fi | ||
tag-does-not-exist: | ||
runs-on: ubuntu-latest | ||
needs: prep | ||
|
@@ -84,7 +84,7 @@ jobs: | |
- name: Check if tag already exists | ||
uses: mukunku/[email protected] | ||
id: checkTag | ||
with: | ||
with: | ||
tag: ${{ needs.prep.outputs.tag }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
@@ -96,20 +96,20 @@ jobs: | |
echo "${{needs.prep.outputs.tag}} already exists" | ||
exit 1 | ||
fi | ||
build: | ||
runs-on: ubuntu-latest | ||
if: always() # Run regardless if tag-does-not-exist fails | ||
needs: | ||
needs: | ||
- prep | ||
- tag-does-not-exist | ||
steps: | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Set up QEMU | ||
uses: docker/[email protected] | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/[email protected] | ||
with: | ||
|
@@ -122,14 +122,14 @@ jobs: | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
# Install the GOSS testing framework | ||
- name: Set up goss/dgoss | ||
uses: e1himself/[email protected] | ||
if: needs.prep.outputs.goss == 'true' | ||
with: | ||
version: 'v0.3.16' | ||
|
||
# Creates a local build to run tests on | ||
- name: Build and Load local test-container | ||
uses: docker/build-push-action@v2 | ||
|
@@ -153,14 +153,14 @@ jobs: | |
GOSS_FILE: ./goss.yaml | ||
run: | | ||
dgoss run ghcr.io/${{ github.repository_owner }}/${{needs.prep.outputs.repo_name}}:test | ||
- name: Login to DockerHub | ||
uses: docker/[email protected] | ||
if: github.event_name != 'pull_request' && needs.tag-does-not-exist.outputs.exists == 'false' | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/[email protected] | ||
if: github.event_name != 'pull_request' && needs.tag-does-not-exist.outputs.exists == 'false' | ||
|
@@ -191,13 +191,16 @@ jobs: | |
tags: | | ||
${{ github.repository_owner }}/${{needs.prep.outputs.repo_name}}:latest | ||
${{ github.repository_owner }}/${{needs.prep.outputs.repo_name}}:${{needs.prep.outputs.tag}} | ||
${{ github.repository_owner }}/${{needs.prep.outputs.repo_name}}:version-${{needs.prep.outputs.version}} | ||
ghcr.io/${{ github.repository_owner }}/${{needs.prep.outputs.repo_name}}:latest | ||
ghcr.io/${{ github.repository_owner }}/${{needs.prep.outputs.repo_name}}:${{needs.prep.outputs.tag}} | ||
ghcr.io/${{ github.repository_owner }}/${{needs.prep.outputs.repo_name}}:version-${{needs.prep.outputs.version}} | ||
quay.io/${{ github.repository_owner }}/${{needs.prep.outputs.repo_name}}:latest | ||
quay.io/${{ github.repository_owner }}/${{needs.prep.outputs.repo_name}}:${{needs.prep.outputs.tag}} | ||
quay.io/${{ github.repository_owner }}/${{needs.prep.outputs.repo_name}}:version-${{needs.prep.outputs.version}} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new | ||
|
||
# This ugly bit is necessary if you don't want your cache to grow forever | ||
# till it hits GitHub's limit of 5GB. | ||
# Temp fix | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2 | ||
3 |