Skip to content

Update packages

Update packages #41

Workflow file for this run

name: Update Version in main.go
on:
push:
tags:
- 'v*'
jobs:
update-version:
runs-on: ubuntu-latest
outputs:
version: ${{ env.VERSION }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
fetch-depth: 0 # Fetch all history for all tags and branches
- name: Get update version
run: |
VERSION=${GITHUB_REF#refs/tags/}
VERSION=${VERSION#v}
echo "New version: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
commit:
needs: update-version
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}
token: ${{ secrets.GH_ACCESS_TOKEN }}
fetch-depth: 0 # Fetch all history for all tags and branches
- name: Update version in main.go
run: |
VERSION=${{ needs.update-version.outputs.version }}
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Dump version to $VERSION"
sed -i "s/var version = \".*\"/var version = \"$VERSION\"/" cmd/server/main.go
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
message: 'Update version to v${{ env.VERSION }}'
add: '.'
author_name: GitHub Actions
author_email: [email protected]
committer_name: GitHub Actions