Update README.md #11
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: Release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
check: | |
name: Check commit message | |
runs-on: ubuntu-latest | |
outputs: | |
commit_message: ${{ steps.check_commit_message.outputs.commit_message }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Check commit message | |
id: check_commit_message | |
run: | | |
commit_message=$(git log --format=%B -n 1 ${{ github.sha }}) | |
if [[ $commit_message =~ ^v[0-9]+\.[0-9]+\.[0-9] ]]; then | |
echo "Commit message matches version format." | |
echo "commit_message=$commit_message" >> "$GITHUB_OUTPUT" | |
else | |
echo "Commit message does not match version format. Skipping release." | |
fi | |
build: | |
name: Build and compress binary | |
needs: [check] | |
if: ${{ needs.check.outputs.commit_message != '' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create necessary directory | |
run: | | |
mkdir -p dist | |
- name: Build binary | |
run: | | |
go build -ldflags "-s -w" -o dist/ui-cli_linux_amd64 | |
- name: Compress binary | |
run: | | |
upx -f --best --lzma dist/ui-cli_linux_amd64 | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ui-cli | |
path: dist | |
release: | |
name: Create release and upload asset | |
needs: [check, build] | |
if: ${{ needs.check.outputs.commit_message != '' }} | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ui-cli | |
path: dist | |
- name: Create release and upload asset | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ needs.check.outputs.commit_message }} | |
name: 🎉 Release ${{ needs.check.outputs.commit_message }} | |
body: | | |
Please follow the [installation guide](https://github.com/Update-Install?view_as=public#installation) to install the latest version of Update Install. | |
generate_release_notes: true | |
append_body: true | |
make_latest: "true" | |
files: | | |
dist/ui-cli_linux_amd64 | |
- name: Delete artifact | |
uses: geekyeggo/delete-artifact@v5 | |
with: | |
name: ui-cli |