ADD:test workflow sed encode #5
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
name: Deploy Application | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
name: publish tag | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' | |
- name: Generate Git Tag | |
id: generate_tag | |
run: | | |
VERSION_PREFIX="v" | |
VERSION_MAJOR_MINOR="5.0" | |
VERSION_PATCH=$(git tag --list "${VERSION_PREFIX}${VERSION_MAJOR_MINOR}.*" --sort=-version:refname | head -n 1 | grep -oE '[0-9]+$') | |
if [ -z "$VERSION_PATCH" ]; then | |
VERSION_PATCH=0 | |
else | |
VERSION_PATCH=$((VERSION_PATCH + 1)) | |
fi | |
NEW_TAG="${VERSION_PREFIX}${VERSION_MAJOR_MINOR}.${VERSION_PATCH}" | |
echo "Generated new tag: $NEW_TAG" | |
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV | |
- name: Push Git Tag | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git tag $NEW_TAG | |
git push origin $NEW_TAG | |
- name: read formula config file | |
run: | | |
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 "url==>${url}" | |
echo "sha256==>${sha256}" | |
rm -rf ./aklog.tar.gz | |
en_url=`echo $url |sed 's#\/#\\\/#g'` | |
sed -e "s/#_url_#/${en_url}/g; s/#_sha256_#/${sha256}/g" .github/data/aklog.rb > .github/data/aklog.rb | |
content=$(cat .github/data/aklog.rb) | |
echo $content |