Skip to content

v0.3.5

v0.3.5 #4

Workflow file for this run

name: Release build
# Original source: https://github.com/Bookshelf-Writer/scripts-for-integration/blob/main/workflows/Example-Build.yml
# When integrating, actions must have write permissions
on:
release:
branches:
- 'main'
types: [created]
jobs:
build:
name: "Build [${{ matrix.os }}]"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
go-version: [1.22.5]
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
########################################################################################################################
- name: Load Info from Build
if: ${{ matrix.os != 'windows-latest' }}
run: |
nameBuild=$(./_run/scripts/sys.sh -n)
versionBuild=$(./_run/scripts/sys.sh -v)
echo "BUILD_NAME=$nameBuild" >> $GITHUB_ENV
echo "BUILD_VER=$versionBuild" >> $GITHUB_ENV
echo "NAME: $nameBuild"
echo "VER: $versionBuild"
- name: Check Tag [linux]
if: ${{ matrix.os != 'windows-latest'}}
run: |
if [[ "${{ github.event.release.tag_name }}" != "${{ env.BUILD_VER }}" ]]; then
curl -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}"
echo "::error ::Incorrect release tag. Should match the [${{ env.BUILD_VER }}]."
exit 1
fi
########################################################################################################################
- name: Push new version [linux]
if: ${{ matrix.os == 'ubuntu-latest'}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
new_version=$(./_run/scripts/sys.sh --increment --minor)
git add ./_run/values/ver.txt
git commit -m "actions [$new_version] "$'\n'"Build: [${{ env.BUILD_VER }}] >> [$new_version]"
git push origin HEAD:main