Skip to content

Github action

Github action #2

Workflow file for this run

permissions:
contents: read
on:
push:
tags:
- "*"
name: Create and Publish release
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Set up Go
id: go
uses: actions/setup-go@v3
with:
go-version: 1.23
- name: Checkout code
uses: actions/checkout@v3
- name: Get Repo Name
id: get_repo_name
run: |
# Extract repo name from GITHUB_REPOSITORY variable
repo_fullname="${{ github.repository }}"
repo_name="${repo_fullname##*/}"
echo "REPO_NAME=${repo_name}" >> $GITHUB_ENV
- name: Compile
id: compile
run: |
make release
- name: Get Tag Name
id: get_tag_name
run: |
# Extract tag or branch name from GITHUB_REF
tag_name="${{ github.ref }}"
tag_name="${tag_name#refs/tags/}"
echo "TAG_NAME=${tag_name}" >> $GITHUB_ENV
- name: Create Release
run: |
echo "Repository Name: $REPO_NAME"
echo "Tag Name: $TAG_NAME"
git archive --format tbz2 --prefix="${REPO_NAME}/" --output "${REPO_NAME}-${TAG_NAME}.zip" HEAD
echo "REPO_NAME=${REPO_NAME}" >> $GITHUB_ENV
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV
- name: Upload Release
uses: softprops/action-gh-release@v1
with:
files: "${{ github.event.repository.name }}-${{ steps.get_tag_name.outputs.TAG_NAME }}.zip"