Skip to content

Commit

Permalink
ops: only do any release steps if ref_type is 'tag'
Browse files Browse the repository at this point in the history
  • Loading branch information
yobson1 committed Nov 18, 2024
1 parent 3dbdb74 commit dea7a4c
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,22 @@ jobs:
sudo apt install libdbus-1-dev libxdo-dev
- name: Install cargo-binstall
if: github.ref_type == 'tag'
uses: cargo-bins/cargo-binstall@main

- name: Install zipsign
if: github.ref_type == 'tag'
run: cargo binstall zipsign && zipsign --version

- name: Retrieve the code signing private key Linux
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-latest' && github.ref_type == 'tag'
env:
BASE64_PRIV_KEY: ${{ secrets.BASE64_PRIV_KEY }}
run: |
echo $BASE64_PRIV_KEY | base64 --decode > priv.key
- name: Retrieve the code signing private key Windows
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-latest' && github.ref_type == 'tag'
env:
BASE64_PRIV_KEY: ${{ secrets.BASE64_PRIV_KEY }}
run: |
Expand All @@ -80,7 +82,7 @@ jobs:
run: cargo build --verbose --release --features "auto-update" --target ${{ matrix.target }}

- name: Prepare Linux Files
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-latest' && github.ref_type == 'tag'
run: |
mkdir -p "dist"
cp "target/${{ matrix.target }}/release/${{ env.PROJECT_NAME }}" "dist/"
Expand All @@ -89,31 +91,32 @@ jobs:
tar czf "../${{ env.PROJECT_NAME }}-${{ matrix.target }}${{ matrix.archive_name }}" *
- name: Prepare Windows Files
if: matrix.os == 'windows-latest'
run: |
if: matrix.os == 'windows-latest' && github.ref_type == 'tag'
run:
mkdir dist
copy "target\${{ matrix.target }}\release\${{ env.PROJECT_NAME }}.exe" "dist\"
copy "target\${{ matrix.target }}\release\${{ env.PROJECT_NAME }}.exe" .
Compress-Archive -Path "dist\*" -DestinationPath "${{ env.PROJECT_NAME }}-${{ matrix.target }}${{ matrix.archive_name }}"

- name: Sign the archive
if: github.ref_type == 'tag'
run: zipsign sign ${{ matrix.os == 'windows-latest' && 'zip' || 'tar' }} ${{ env.PROJECT_NAME }}-${{ matrix.target }}${{ matrix.archive_name }} priv.key

- name: Generate Changelog
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-latest' && github.ref_type == 'tag'
uses: orhun/git-cliff-action@v4
with:
args: -vv --latest --strip header
env:
OUTPUT: CHANGELOG.md

- name: Append Usage Section
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-latest' && github.ref_type == 'tag'
run: |
echo -e "\n### Usage\nwebfishing-midi.exe for windows\nwebfishing-midi for linux" >> CHANGELOG.md
- name: Create GitHub Release
if: ${{ github.ref_type == 'tag' }}
if: github.ref_type == 'tag'
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
Expand Down

0 comments on commit dea7a4c

Please sign in to comment.