Skip to content

GH Action update files #31

GH Action update files

GH Action update files #31

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-hash.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/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@v4
- 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-hash
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 "env.release_tag=${{ env.release_tag }}"
echo "github.ref=${{ github.ref }}"
echo "github.sha=${{ github.sha }}"
echo "commit_hash=${{ needs.change_build_info.outputs.commit_hash }}"
- name: publish release assets
uses: softprops/action-gh-release@master
with:
generate_release_notes: true
target_commitish: ${{ needs.change_build_info.outputs.commit_hash }}
# files: |
# ${{ steps.vars.outputs.PKG_PATH }}