Skip to content

fix(ci): do not run release on release #46

fix(ci): do not run release on release

fix(ci): do not run release on release #46

Workflow file for this run

name: CI
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
release:
types: [ published ]
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22
- name: Install dependencies
run: go mod download
- name: Verify module integrity
run: go mod tidy
- name: Run tests
run: go test -v ./...
release:
name: Release
runs-on: ubuntu-latest
if: github.event_name != 'release'
needs: test
permissions:
contents: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '21'
- name: Install semantic-release
run: npm install -g semantic-release @semantic-release/changelog @semantic-release/git @semantic-release/github @semantic-release/release-notes-generator @semantic-release/exec
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: semantic-release
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: triargos/webdav-go
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v5
if : github.event.release.prerelease == false
with:
platforms: linux/arm64,linux/amd64
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Push prerelease Docker image
if: github.event.release.prerelease == true
uses: docker/build-push-action@v5
with:
platforms: linux/arm64,linux/amd64
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}-prerelease
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max