Skip to content

Commit

Permalink
Add version tag
Browse files Browse the repository at this point in the history
Signed-off-by: nιcнolaѕ wιlde <[email protected]>
  • Loading branch information
nicholaswilde committed Jun 26, 2021
1 parent d6e13fd commit 1885c10
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
35 changes: 19 additions & 16 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}
Expand All @@ -74,7 +74,7 @@ jobs:
else
echo ::set-output name=push::true
fi
tag-does-not-exist:
runs-on: ubuntu-latest
needs: prep
Expand All @@ -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 }}
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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'
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.14.15-alpine3.13 as build
FROM golang:1.16.5-alpine3.14 as build
ARG VERSION
ARG CHECKSUM
ARG FILENAME=${VERSION}.tar.gz
Expand All @@ -21,7 +21,7 @@ RUN \
go get -d -v ./... && \
go install -v ./...

FROM ghcr.io/linuxserver/baseimage-alpine:3.13
FROM ghcr.io/linuxserver/baseimage-alpine:3.14
ARG BUILD_DATE
ARG VERSION
ENV GOPATH /go
Expand Down
2 changes: 1 addition & 1 deletion LS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2
3

0 comments on commit 1885c10

Please sign in to comment.