Skip to content

Update base image to 1.20.7 #41

Update base image to 1.20.7

Update base image to 1.20.7 #41

Workflow file for this run

name: Main
on: [push, pull_request]
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
# On tag, get tag version without v (e.g. v1.0.0 -> 1.0.0, v1.1.1-beta -> 1.1.1-beta)
- name: Get tag version
id: get_version
run: |
if [[ $GITHUB_REF == "refs/tags/v"* ]]; then
echo "Found release tag"
VERSION=${GITHUB_REF/refs\/tags\/v}
else
echo "No release tag found"
VERSION="local-build-only"
fi
echo "Using version: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
# Build and test binary
- name: Build and Test Binary
env:
CGO_ENABLED: 0
run: |
go mod download
go test -test.timeout 50s
GOOS=linux GOARCH=amd64 go build -o build/linux/amd64/scuttle -ldflags="-X 'main.Version=${{ steps.get_version.outputs.VERSION }}'"
# Build Docker image
# On tag, push Docker image
- name: Build Docker Image
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
repository: kvij/scuttle
tags: latest,${{ steps.get_version.outputs.VERSION }}
push: ${{ startsWith(github.ref, 'refs/tags/') }}
build_args: VERSION=${{ steps.get_version.outputs.VERSION }}
# On tag, Pack zip of scuttle for GitHub Release
- name: Pack
run: |
mkdir build/artifacts
zip -r -j build/artifacts/scuttle-linux-amd64.zip build/linux/amd64/
if: startsWith(github.ref, 'refs/tags/')
# On tag, Create GitHub Release
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: build/artifacts/*.zip