skip backup when next run is in the past #45
Workflow file for this run
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
name: release | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
# setup | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ">=1.20.0" | |
check-latest: true | |
- uses: nolar/setup-k3d-k3s@v1 | |
with: | |
skip-creation: true | |
skip-readiness: true | |
- name: Get Version | |
id: get_version | |
run: echo "VERSION=${GITHUB_REF##*/}" >> "${GITHUB_OUTPUT}" | |
# run all tests | |
- name: Tests | |
run: ./test/run all | |
# release | |
- name: Run Goreleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
version: latest | |
args: release --config=.goreleaser.yaml --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VERSION: ${{ steps.get_version.outputs.VERSION }} | |
# build and push docker image | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- uses: actions/checkout@v4 | |
- name: Build and push | |
env: | |
VERSION: ${{ steps.get_version.outputs.VERSION }} | |
run: | | |
IMAGE=docker.io/${{ vars.DOCKERHUB_USERNAME }}/${{ vars.DOCKERHUB_REPOSITORY }} | |
echo version=$VERSION | |
cat docker/Dockerfile | |
docker build . -t $IMAGE:$VERSION -t $IMAGE:latest -f docker/Dockerfile --build-arg VERSION=$VERSION | |
docker push $IMAGE:$VERSION | |
docker push $IMAGE:latest |