Fix artifact upload error #12
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: Build, Sign, and Release ForceBindIP GUI | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: [ubuntu-latest] | |
if: ${{ !contains(github.event.head_commit.message, '[skip-ci]') }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Get short SHA | |
id: get_short_sha | |
if: ${{ !contains(github.event.head_commit.message, '[release]') }} | |
run: echo "short_sha=$(echo ${{ github.sha }} | cut -c1-10)" >> $GITHUB_ENV | |
- name: Get current date and time in UTC | |
id: get_date | |
if: ${{ !contains(github.event.head_commit.message, '[release]') }} | |
run: | | |
utc_date=$(TZ='UTC' date +'%Y-%m-%d @ %H:%M:%S') | |
echo "date=$utc_date" >> $GITHUB_ENV | |
- name: Write build details to file | |
if: ${{ !contains(github.event.head_commit.message, '[release]') }} | |
run: | | |
printf "%s\n%s" "${{ env.date }}" "${{ env.short_sha }}" > build_details.txt | |
- name: Package Application | |
uses: JackMcKew/pyinstaller-action-windows@main | |
with: | |
path: . | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ForceBindIPGUI_unsigned | |
path: dist/windows/ForceBindIP-GUI.exe | |
sign: | |
runs-on: [windows-latest] | |
needs: build | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ForceBindIPGUI | |
path: ./dist | |
# https://melatonin.dev/blog/code-signing-on-windows-with-azure-trusted-signing/#step-9-trusted-signing-in-ci-github | |
- name: Azure Trusted Signing | |
uses: azure/trusted-signing-action@v0.5.0 | |
with: | |
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }} | |
endpoint: ${{ secrets.AZURE_ENDPOINT }} | |
trusted-signing-account-name: ${{ secrets.AZURE_CODE_SIGNING_NAME }} | |
certificate-profile-name: ${{ secrets.AZURE_CERT_PROFILE_NAME }} | |
file-digest: SHA256 | |
timestamp-rfc3161: http://timestamp.acs.microsoft.com | |
timestamp-digest: SHA256 | |
# Sign all exes inside the folder | |
files-folder: ./dist | |
files-folder-filter: exe | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ForceBindIPGUI | |
path: ./dist/ForceBindIP-GUI.exe | |
release: | |
runs-on: [ubuntu-latest] | |
needs: sign | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get short SHA | |
id: get_short_sha | |
run: echo "short_sha=$(echo ${{ github.sha }} | cut -c1-10)" >> $GITHUB_ENV | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ForceBindIPGUI | |
path: ./dist | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: cicd-${{ github.run_number }} | |
name: cicd-${{ env.short_sha }} | |
body: | | |
Release triggered by commit [${{ env.short_sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}): ${{ github.event.head_commit.message }} | |
files: ./dist/ForceBindIP-GUI.exe | |
make_latest: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |