fix bug 'fatal: You are not currently on a branch.' #34
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .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 }} | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push the | |
# added or changed files to the repository. | |
contents: write | |
steps: | |
- name: checkout | |
uses: actions/checkout@master | |
with: | |
ref: master | |
fetch-depth: 0 # To get all tags | |
# - 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/pkgver=.*/pkgver=`git describe --tags --abbrev=0`/g" ./build/APKBUILD | |
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@v5 | |
# - name: commit files | |
# 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" | |
# fi | |
# | |
# - name: push changes | |
# uses: ad-m/github-push-action@master | |
# with: | |
# github_token: ${{ secrets.GITHUB_TOKEN }} | |
# force: true | |
# | |
# - name: output value | |
# id: commit-and-push | |
# run: | | |
# echo "commit_hash=$(git rev-parse HEAD)" | |
# echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
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: print value | |
id: print | |
run: | | |
echo "github.ref=${{ github.ref }}" | |
echo "github.sha=${{ github.sha }}" | |
echo "commit_hash=${{ needs.change_build_info.outputs.commit_hash }}" | |
head -n 21 build/APKBUILD | |
- name: publish release assets | |
uses: softprops/action-gh-release@master | |
with: | |
generate_release_notes: false | |
target_commitish: ${{ needs.change_build_info.outputs.commit_hash }} | |
# files: | | |
# ${{ steps.vars.outputs.PKG_PATH }} |