CI: Use a single package workflow to build and release

Allows creating the release in one go, avoids release data getting overwritten by different jobs
This commit is contained in:
Philipp Wolfer
2020-01-29 09:21:51 +01:00
parent a8da256764
commit 25c1f874c9
3 changed files with 97 additions and 114 deletions

View File

@@ -1,30 +0,0 @@
name: Prepare release
on:
push:
tags:
- 'release-*'
jobs:
prepare-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Prepare changelog
id: changelog
continue-on-error: true
run: |
PICARD_VERSION=$(python -c "import picard; print(picard.__version__)")
echo "::set-output name=version::"$PICARD_VERSION
./scripts/tools/changelog-for-version.py $PICARD_VERSION > changes-$PICARD_VERSION.txt
- name: Update release
uses: softprops/action-gh-release@v1
with:
name: MusicBrainz Picard ${{ steps.changelog.outputs.version }}
body_path: changes-${{ steps.changelog.outputs.version }}.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,77 +0,0 @@
name: Package for macOS
on:
push:
paths:
- '.github/workflows/package-macos.yml'
- 'picard/**'
- 'po/**.po'
- 'resources/win10/**'
- 'scripts/package/*'
- '!scripts/package/*.ps1'
- 'scripts/pyinstaller/*'
- 'picard.icns'
- 'picard.spec'
- 'requirements*.txt'
- 'setup.py'
- 'tagger.py.in'
pull_request:
jobs:
package:
runs-on: macos-latest
env:
DISCID_VERSION: 0.6.2
FPCALC_VERSION: 1.4.4-9
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Cache libdiscid
uses: actions/cache@v1
with:
path: ~/libdiscid
key: ${{ runner.os }}-libdiscid-${{ env.DISCID_VERSION }}
- name: Patch build version
if: startsWith(github.ref, 'refs/tags/') != true
run: |
python setup.py patch_version --platform=$(git rev-list --count HEAD).$(git rev-parse --short HEAD)
- name: Setup macOS build environment
run: |
./scripts/package/macos-setup.sh
mkdir artifacts
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements-build.txt
pip install -r requirements-macos.txt
- name: Run tests
run: |
python setup.py test
- name: Build macOS app
run: |
./scripts/package/macos-package-app.sh
mv dist/*.dmg artifacts/
env:
APPLE_ID_USER: ${{ secrets. APPLE_ID_USER }}
APPLE_ID_PASSWORD: ${{ secrets. APPLE_ID_PASSWORD }}
encrypted_be5fb2212036_key: ${{ secrets.CODESIGN_MACOS_ENCRYPTED_KEY }}
encrypted_be5fb2212036_iv: ${{ secrets.CODESIGN_MACOS_ENCRYPTED_IV }}
appledev_p12_password: ${{ secrets.CODESIGN_MACOS_P12_PASSWORD }}
- name: Archive production artifacts
uses: actions/upload-artifact@v1
if: always()
with:
name: macos-builds
path: artifacts/
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,16 +1,17 @@
name: Package for Windows
name: Package and release
on:
push:
paths:
- '.github/workflows/package-windows.yml'
- '.github/workflows/package.yml'
- 'installer/**'
- 'picard/**'
- 'po/**.po'
- 'resources/win10/**'
- 'scripts/package/*.ps1'
- 'scripts/package/*'
- 'scripts/pyinstaller/*'
- 'appxmanifest.xml.in'
- 'picard.icns'
- 'picard.ico'
- 'picard.spec'
- 'requirements*.txt'
@@ -20,7 +21,56 @@ on:
pull_request:
jobs:
package:
package-macos:
runs-on: macos-latest
env:
DISCID_VERSION: 0.6.2
FPCALC_VERSION: 1.4.4-9
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Cache libdiscid
uses: actions/cache@v1
with:
path: ~/libdiscid
key: ${{ runner.os }}-libdiscid-${{ env.DISCID_VERSION }}
- name: Patch build version
if: startsWith(github.ref, 'refs/tags/') != true
run: |
python setup.py patch_version --platform=$(git rev-list --count HEAD).$(git rev-parse --short HEAD)
- name: Setup macOS build environment
run: |
./scripts/package/macos-setup.sh
mkdir artifacts
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements-build.txt
pip install -r requirements-macos.txt
- name: Run tests
run: |
python setup.py test
- name: Build macOS app
run: |
./scripts/package/macos-package-app.sh
mv dist/*.dmg artifacts/
env:
APPLE_ID_USER: ${{ secrets. APPLE_ID_USER }}
APPLE_ID_PASSWORD: ${{ secrets. APPLE_ID_PASSWORD }}
encrypted_be5fb2212036_key: ${{ secrets.CODESIGN_MACOS_ENCRYPTED_KEY }}
encrypted_be5fb2212036_iv: ${{ secrets.CODESIGN_MACOS_ENCRYPTED_IV }}
appledev_p12_password: ${{ secrets.CODESIGN_MACOS_P12_PASSWORD }}
- name: Archive production artifacts
uses: actions/upload-artifact@v1
if: always()
with:
name: macos-app
path: artifacts/
package-windows:
runs-on: windows-latest
strategy:
matrix:
@@ -118,10 +168,50 @@ jobs:
with:
name: windows-${{ matrix.type }}
path: artifacts/
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
github-release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs:
- package-macos
- package-windows
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: 3.8
- uses: actions/download-artifact@v1
with:
name: macos-app
path: artifacts/
- uses: actions/download-artifact@v1
with:
name: windows-signed-app
path: artifacts/
- uses: actions/download-artifact@v1
with:
name: windows-store-app
path: artifacts/
- uses: actions/download-artifact@v1
with:
name: windows-installer
path: artifacts/
- uses: actions/download-artifact@v1
with:
name: windows-portable
path: artifacts/
- name: Prepare changelog
id: changelog
continue-on-error: true
run: |
PICARD_VERSION=$(python -c "import picard; print(picard.__version__)")
echo "::set-output name=version::"$PICARD_VERSION
./scripts/tools/changelog-for-version.py $PICARD_VERSION > changes-$PICARD_VERSION.txt
- name: Create release
uses: softprops/action-gh-release@v1
with:
name: MusicBrainz Picard ${{ steps.changelog.outputs.version }}
body_path: changes-${{ steps.changelog.outputs.version }}.txt
files: artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}