Skip to content

changed repository access pattern #18

changed repository access pattern

changed repository access pattern #18

Workflow file for this run

name: Release
on:
push:
branches: [ main ]
paths:
- '**.go'
- 'go.mod'
- 'go.sum'
- '.github/workflows/release.yml'
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:latest
ports:
- 27017:27017
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true
- name: Install dependencies
run: go mod download
- name: Run tests
run: go test -v -race ./...
release:
name: Create Release
needs: test
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get latest tag
id: get_latest_tag
run: |
git fetch --tags
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1` 2>/dev/null || echo "v0.0.0")
echo "LATEST_TAG=$latest_tag" >> $GITHUB_ENV
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: patch
default_prerelease_bump: patch
release_branches: main
tag_prefix: v
- name: Create Release
uses: softprops/action-gh-release@v1
if: steps.tag_version.outputs.new_tag != steps.get_latest_tag.outputs.LATEST_TAG
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: |
## What's Changed
${{ steps.tag_version.outputs.changelog }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}