Skip to content
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@v2
- name: Set up Python
uses: actions/setup-python@v4
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@v3
with:
name: ForceBindIPGUI
path: dist/windows/ForceBindIP-GUI.exe
sign-and-release:
runs-on: [ubuntu-latest]
needs: build
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: ForceBindIPGUI
path: ./dist
- name: Get short SHA
id: get_short_sha
run: echo "short_sha=$(echo ${{ github.sha }} | cut -c1-10)" >> $GITHUB_ENV
# 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/[email protected]
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 }}
code-signing-account-name: ${{ secrets.AZURE_CODE_SIGNING_NAME }}
certificate-profile-name: ${{ secrets.AZURE_CERT_PROFILE_NAME }}
# Sign all exes inside the folder
files-folder: ./dist
files-folder-filter: exe
- 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
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run latest-tag
uses: EndBug/latest-tag@latest
with:
ref: latest
description: |
Latest release - triggered by commit [${{ env.short_sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
force-branch: false
git-directory: '.'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}