Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

v0.0.1

v0.0.1 #35

Workflow file for this run

name: ci
on:
push:
branches: [main]
paths-ignore: ['**.md', '.vscode/**', 'site/**']
pull_request:
branches: [main]
paths-ignore: ['**.md', '.vscode/**', 'site/**']
release:
types: [published]
workflow_dispatch:
permissions:
contents: write
jobs:
ci:
name: CI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21.4'
- name: Get tag and set version on release
if: startsWith(github.ref, 'refs/tags/v')
env:
VERSION: '${{ github.ref_name }}'
run: |
echo "VERSION: $VERSION"
sed "s|version = \"v.*\"|version = \"$VERSION\"|" -i version.go
cat -n version.go
- name: Set VERSION env var
run: |
if [[ $GITHUB_REF == "refs/tags/v"* ]]; then
echo "VERSION=$GITHUB_REF_NAME" >> "$GITHUB_ENV"
else
echo "VERSION=${GITHUB_SHA::7}" >> "$GITHUB_ENV"
fi
- name: Build (linux/amd64)
run: |
GOOS=linux GOARCH=amd64 go build -v -x -ldflags '-w -s' -o "zsv-playground-$VERSION-linux-amd64"
zip "zsv-playground-$VERSION-linux-amd64.zip" "zsv-playground-$VERSION-linux-amd64"
- name: Upload
uses: actions/upload-artifact@v4
with:
name: zsv-playground-${{ env.VERSION }}-linux-amd64
path: zsv-playground-${{ env.VERSION }}-linux-amd64
if-no-files-found: error
- name: Upload with release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
files: zsv-playground-${{ env.VERSION }}-linux-amd64.zip
- name: Bump version [${{ env.VERSION }}]
if: startsWith(github.ref, 'refs/tags/v')
run: |
git config user.name 'github-actions'
git config user.email '[email protected]'
git fetch
git checkout main
git add version.go
if [[ $(git diff) != "" ]]; then
git commit -m "[CI] Bump version to $VERSION"
git push -u origin main
fi