Skip to content

Just to check, how to tags work #15

Just to check, how to tags work

Just to check, how to tags work #15

Workflow file for this run

name: "Build"
on:
#workflow_dispatch:
# inputs:
# version:
# description: "Semver version to deploy"
# required: true
push:
branches:
- master
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
permissions:
contents: read
actions: read
checks: write
jobs:
build:
name: "🚀 Build and Publish Image"
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]' && (github.ref_name == 'main' || startsWith(github.ref, 'refs/tags') == true)
timeout-minutes: 30
env:
docker-image: ${{ secrets.DOCKER_HUB_USERNAME }}/vixen
defaults:
run:
working-directory: ./
steps:
- name: 📦 Checkout the repo
uses: actions/checkout@v4
- name: 🔢 Get version from tags
id: version
run: |
SEM_VERSION="${GITHUB_REF#refs/tags/v}"
BUILD_VERSION=$(date +%s)
VERSION="${SEM_VERSION}+${BUILD_VERSION}"
echo "SEM_VERSION=$SEM_VERSION" >> $GITHUB_OUTPUT
echo "BUILD_VERSION=$BUILD_VERSION" >> $GITHUB_OUTPUT
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Version set to $VERSION"
- name: 🐳 Set up QEMU
uses: docker/setup-qemu-action@v3
- name: 🐳 Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 📦 Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: 🚀 Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/arm64,linux/amd64
push: true
tags: ${{ env.docker-image }}:latest, ${{ env.docker-image }}:${{ steps.version.outputs.SEM_VERSION }}
deploy:
name: "🚢 Deploy Vixen bot"
runs-on: ubuntu-latest
needs: build
timeout-minutes: 10
steps:
- name: Trigger Portainer Webhook
run: |
echo "Trigger Portainer Webhook to update the service"
curl -X POST "$PORTAINER_WEBHOOK_URL"
env:
PORTAINER_WEBHOOK_URL: ${{ secrets.PORTAINER_WEBHOOK_URL }}