diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..340b28d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,57 @@ +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" diff --git a/Makefile b/Makefile index 0f495b4..fbc726c 100644 --- a/Makefile +++ b/Makefile @@ -96,10 +96,3 @@ release: clean lint test done; \ done @ls -sSFhC1 release - -release-push: - @for crunched_name in $$(ls -sSFhC1 release); do \ - echo "Pushing $$crunched_name"; \ - gh release upload $VERSION $$crunched_name; \ - done - @echo "Released"