Skip to content

manually commit to replace stefanzweifel/git-auto-commit-action. #21

manually commit to replace stefanzweifel/git-auto-commit-action.

manually commit to replace stefanzweifel/git-auto-commit-action. #21

Workflow file for this run

# .github/workflows/release.yaml
name: new release
on:
push:
tags:
- "*" # triggers only if push new tag version, like `0.8.4` or else
env:
PROJECT: aprilsh
BIN_DIR: bin
permissions:
contents: write
pull-requests: write
jobs:
change_build_info:
strategy:
fail-fast: false
runs-on: ubuntu-latest
outputs:
commit_hash: ${{ steps.commit-and-push.outputs.commit_hash }}
steps:
- name: checkout
uses: actions/checkout@master
# - name: Set up Go
# uses: actions/setup-go@master
# with:
# go-version: 1.21
- name: change build info
id: change
shell: bash
run: |
git config --global --add safe.directory /__w/aprilsh/aprilsh
sed -i -e "s/.*_GitVersion=.*/_GitVersion=`git describe --tags`/g" ./build/APKBUILD
sed -i -e "s/.*_GitCommit=.*/_GitCommit=`git rev-parse HEAD`/g" ./build/APKBUILD
sed -i -e "s/.*_GitBranch=.*/_GitBranch=`git rev-parse --abbrev-ref HEAD`/g" ./build/APKBUILD
# - name: Commit and Push Changes
# id: commit-and-push
# uses: stefanzweifel/git-auto-commit-action@v4
- name: commit files
id: commit-and-push
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
if ! git diff --exit-code; then
git add build/APKBUILD
git commit -m "GH Action update files"
git push
echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
fi
#
# - name: push changes
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# force: true
release:
needs: change_build_info
runs-on: ubuntu-latest
steps:
- name: checkout repo again
uses: actions/checkout@master
with:
ref: ${{ needs.change_build_info.outputs.commit_hash }}
- name: publish release assets
uses: softprops/action-gh-release@master
with:
generate_release_notes: true
files: |
${{ steps.vars.outputs.PKG_PATH }}