Skip to content

Update: GH action to read the token #60

Update: GH action to read the token

Update: GH action to read the token #60

# This workflow will install Python dependencies, create Hamster dist for Windows, macOS (Intel and Apple).
# It will also create a GitHub release and upload the artifacts to it.
name: Hamster
on:
push:
branches: [ "feature/telemetry" ]
paths-ignore:
- '**/**.md'
jobs:
build:
runs-on: ${{ matrix.os }}
env:
RELEASE_TAG: 0.2.0
INTEL_DMG: Hamster-x86-64-intel.dmg
ARM64_DMG: Hamster-arm64-silicon.dmg
MIXPANEL_TOKEN: ${{ secrets.MIXPANEL_TOKEN }}
strategy:
matrix:
os: [ self-hosted, macos, windows-latest ]
arch: [ 'X64', 'ARM64', 'X86' ]
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10.11
uses: actions/setup-python@v3
with:
python-version: "3.10.11"
- name: Install dependencies in Windows
run: |
python -m pip install --upgrade pip
pip install -r .\windows\requirements.txt
if: matrix.os == 'windows-latest'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install py2app
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if: matrix.os == 'macos' || matrix.os == 'self-hosted'
- name: Generate app for intel architecture
run: |
export MIXPANEL_TOKEN=${{ env.MIXPANEL_TOKEN }}
python setup.py py2app
mv dist dist-intel
if: matrix.os == 'macos' && matrix.arch == 'X64'
- name: Generate app for arm64 architecture
run: |
export MIXPANEL_TOKEN=${{ env.MIXPANEL_TOKEN }}
python setup.py py2app
mv dist dist-arm64
if: matrix.os == 'self-hosted' && matrix.arch == 'ARM64'
- name: Generate app for windows
run: |
python .\windows\setup.py bdist_msi
mv dist dist-windows
if: matrix.os == 'windows-latest'
- name: Convert dist-intel to DMG
run: |
hdiutil create -volname "Hamster" -srcfolder dist-intel -ov -format UDZO dist-intel/${{ env.INTEL_DMG }}
if: matrix.os == 'macos' && matrix.arch == 'X64'
- name: Convert dist-arm64 to DMG
run: |
hdiutil create -volname "Hamster" -srcfolder dist-arm64 -ov -format UDZO dist-arm64/${{ env.ARM64_DMG }}
if: matrix.os == 'self-hosted' && matrix.arch == 'ARM64'
- name: Upload intel app
uses: actions/upload-artifact@v2
with:
name: Hamster-macos-intel-x86_64
path: dist-intel/${{ env.INTEL_DMG }}
if: matrix.os == 'macos' && matrix.arch == 'X64'
- name: Upload arm64 app
uses: actions/upload-artifact@v2
with:
name: Hamster-macos-apple-arm64
path: dist-arm64/${{ env.ARM64_DMG }}
if: matrix.os == 'self-hosted' && matrix.arch == 'ARM64'
- name: Upload windows app
uses: actions/upload-artifact@v2
with:
name: Hamster-windows-x86_64
path: dist-windows/Hamster-*.msi
if: matrix.os == 'windows-latest'
- name: GitHub Tag
uses: mathieudutour/[email protected]
with:
custom_tag: ${{ env.RELEASE_TAG }}
github_token: ${{ secrets.HAMSTER_APP_RELEASE_SECRET }}
- name: Release Darwin
uses: softprops/action-gh-release@v1
if: github.ref == 'refs/heads/main' && matrix.os == 'self-hosted' && matrix.arch == 'ARM64'
with:
token: ${{ secrets.HAMSTER_APP_RELEASE_SECRET }}
body: 'Release for commit ${{ github.sha }}'
tag_name: ${{ env.RELEASE_TAG }}
generate_release_notes: true
files: |
dist-arm64/${{ env.ARM64_DMG }}
- name: Release Intel
uses: softprops/action-gh-release@v1
if: github.ref == 'refs/heads/main' && matrix.os == 'macos' && matrix.arch == 'X64'
with:
token: ${{ secrets.HAMSTER_APP_RELEASE_SECRET }}
body: 'Release for commit ${{ github.sha }}'
generate_release_notes: true
tag_name: ${{ env.RELEASE_TAG }}
files: |
dist-intel/${{ env.INTEL_DMG }}
- name: Release Windows
uses: softprops/action-gh-release@v1
if: github.ref == 'refs/heads/main' && matrix.os == 'windows-latest'
with:
token: ${{ secrets.HAMSTER_APP_RELEASE_SECRET }}
body: 'Release for commit ${{ github.sha }}'
generate_release_notes: true
tag_name: ${{ env.RELEASE_TAG }}
files: |
dist-windows/Hamster-*.msi