Skip to content

MOD:add version

MOD:add version #52

Workflow file for this run

name: Release Application
on:
push:
branches:
- master
jobs:
build:
name: publish tag
runs-on: ubuntu-latest
steps:
- shell: bash
run: |
echo "## Release Application" >> $GITHUB_STEP_SUMMARY
echo "### build and push tag for aklog" >> $GITHUB_STEP_SUMMARY
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-tags: 'true'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: read cfg to env
id: read_cfg
uses: mikefarah/yq@master
with:
cmd: |
VERSION_PREFIX=$(yq '.version.prefix' cfg.yml)
echo "VERSION_PREFIX:${VERSION_PREFIX}"
v_major=$(yq '.version.major' cfg.yml)
echo "v_major:${v_major}"
v_minor=$(yq '.version.minor' cfg.yml)
echo "v_minor:${v_minor}"
VERSION_MAJOR_MINOR="${v_major}.${v_minor}"
echo "VERSION_MAJOR_MINOR:${VERSION_MAJOR_MINOR}"
echo "VERSION_PREFIX=$VERSION_PREFIX" >> $GITHUB_ENV
echo "VERSION_MAJOR_MINOR=$VERSION_MAJOR_MINOR" >> $GITHUB_ENV
- name: generate git tag
id: gennerate_tag
run: python .github/build_new_tag.py
- name: Push Git Tag
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git tag $NEW_TAG
git push origin $NEW_TAG
echo "- :white_check_mark: push tag done." >> $GITHUB_STEP_SUMMARY
- name: update formula config file
id: update_formula
run: |
echo "- :white_check_mark: update formula config file" >> $GITHUB_STEP_SUMMARY
url="https://github.com/wswenyue/aklog/archive/${NEW_TAG}.tar.gz"
sha256=$(wget -O aklog.tar.gz ${url} && shasum -a 256 aklog.tar.gz | cut -d ' ' -f 1)
echo "> version: ${NEW_VERSION}" >> $GITHUB_STEP_SUMMARY
echo "> new_tag: ${NEW_TAG}" >> $GITHUB_STEP_SUMMARY
echo "> url: ${url}" >> $GITHUB_STEP_SUMMARY
echo "> sha256: ${sha256}" >> $GITHUB_STEP_SUMMARY
rm -rf ./aklog.tar.gz
en_url=`echo $url |sed 's#\/#\\\/#g'`
sed -e "s/#_version_#/${NEW_VERSION}/g; s/#_url_#/${en_url}/g; s/#_sha256_#/${sha256}/g" .github/data/aklog.rb > formula.rb
echo "- :arrow_double_up: upload formula file ..." >> $GITHUB_STEP_SUMMARY
- name: upload new Formula
uses: actions/upload-artifact@v4
with:
name: formula
path: formula.rb
homebrew:
name: publish homebrew
needs: build
runs-on: ubuntu-latest
permissions:
pull-requests: write # 'write' access to pull requests
contents: write # We generate static HTML, JS, CSS so we need write access to the repo
pages: write
id-token: write
deployments: write
statuses: write
actions: write
checks: read
steps:
- shell: bash
run: |
echo "### publish homebrew aklog" >> $GITHUB_STEP_SUMMARY
- name: Checkout homebrew-aklog
uses: actions/checkout@v4
with:
repository: wswenyue/homebrew-aklog
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
persist-credentials: true
- name: Download formula
uses: actions/download-artifact@v4
with:
name: formula
- shell: bash
run: |
echo "- :white_check_mark: checkout done." >> $GITHUB_STEP_SUMMARY
echo "- :white_check_mark: download formula down." >> $GITHUB_STEP_SUMMARY
cat formula.rb > Formula/aklog.rb
rm -rf formula.rb
echo "- :white_check_mark: overwrite formula file." >> $GITHUB_STEP_SUMMARY
- name: Commit files
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
ls -alh
git status
git commit -a -m "rebot publish commit"
echo "- :white_check_mark: git add and commit." >> $GITHUB_STEP_SUMMARY
- name: Push changes
uses: ad-m/github-push-action@master
with:
repository: wswenyue/homebrew-aklog
ssh: true
branch: ${{ github.ref }}
- shell: bash
run: |
echo "- :white_check_mark: git push succeed." >> $GITHUB_STEP_SUMMARY
echo "### :smile: I'm so lucky to have done this. Congratulations!!! :smile:" >> $GITHUB_STEP_SUMMARY