-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit 87e457e.
- Loading branch information
1 parent
dfc5fc0
commit a536cb6
Showing
2 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
name: Create pull request release | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
|
||
jobs: | ||
create-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the source code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Determine the tag | ||
run: echo betty_tag=0.0.0+dev-pull-request-${{ github.event.number }} >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Create/reassign the tag | ||
run: git tag -f '${{ env.betty_tag }}' | ||
|
||
- name: Push the tag | ||
run: git push -f origin '${{ env.betty_tag }}' | ||
|
||
- name: Create the pull request release, if it does not exist already | ||
run: gh release create '${{ env.betty_tag }}' --prerelease --notes 'This is an unstable development release for https://github.com/bartfeenstra/betty/pull/${{ github.event.number }}. It will be deleted once the pull request is closed.' || true | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
build-pyinstaller: | ||
needs: | ||
- create-release | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
include: | ||
- name: macOS | ||
os: macos-latest | ||
dist_name: betty-macos | ||
python: '3.12' | ||
- name: Windows | ||
os: windows-2019 | ||
dist_name: betty-windows | ||
python: '3.12' | ||
steps: | ||
- name: Check out the source code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Determine the tag | ||
run: echo betty_tag=0.0.0+dev-pull-request-${{ github.event.number }} >> $GITHUB_ENV | ||
shell: bash | ||
|
||
# Ubuntu 20.04 ships with an older pip version. | ||
- name: Update pip | ||
if: startsWith(runner.os, 'Linux') | ||
run: pip install --upgrade pip | ||
|
||
- name: Get the pip cache directory | ||
run: echo "pip_cache_dir=$(pip cache dir)" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Cache pip | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.pip_cache_dir }} | ||
key: pip-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('./setup.py') }} | ||
restore-keys: | | ||
pip-${{ runner.os }}-${{ matrix.python }}- | ||
- name: Get the npm cache directory | ||
run: echo "npm_cache_dir=$(npm config get cache)" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Cache npm | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.npm_cache_dir }} | ||
key: npm-${{ runner.os }}-${{ hashFiles('./package.json') }} | ||
restore-keys: | | ||
npm-${{ runner.os }}- | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Build the executable | ||
run: ./bin/build-pyinstaller ${{ env.betty_tag }}-${{ github.event.pull_request.head.sha }} | ||
shell: bash | ||
|
||
- name: Zip the macOS package | ||
if: startsWith(runner.os, 'macOS') | ||
run: zip -r -X ./dist/${{ matrix.dist_name }}-${{ github.event.pull_request.head.sha }}.zip ./dist/betty | ||
shell: bash | ||
|
||
- name: Zip the Windows package | ||
if: startsWith(runner.os, 'Windows') | ||
run: Compress-Archive .\dist\betty .\dist\${{ matrix.dist_name }}-${{ github.event.pull_request.head.sha }}.zip | ||
|
||
- name: Publish the package | ||
run: gh release upload ${{ env.betty_tag }} ./dist/${{ matrix.dist_name }}-${{ github.event.pull_request.head.sha }}.zip --clobber | ||
shell: bash | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
notify: | ||
needs: | ||
- build-pyinstaller | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the source code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Determine the tag | ||
run: echo betty_tag=0.0.0+dev-pull-request-${{ github.event.number }} >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Notify collaborators of the release | ||
run: gh pr comment ${{ github.event.pull_request.number }} --body $'Uploaded Betty for commit ${{ github.event.pull_request.head.sha }}. You can download it, test it, and post your feedback in a comment to this pull request 💕\n- [Betty Desktop for **macOS** 🍎](https://github.com/bartfeenstra/betty/releases/download/${{ env.betty_tag }}/betty-macos-${{ github.event.pull_request.head.sha }}.zip)\n- [Betty Desktop for **Windows** 🪟](https://github.com/bartfeenstra/betty/releases/download/${{ env.betty_tag }}/betty-windows-${{ github.event.pull_request.head.sha }}.zip)\n\nThese downloads will stop working when the pull request is closed.' | ||
shell: bash | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Remove pull request release | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
delete-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the source code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Determine the tag | ||
run: echo betty_tag=0.0.0+dev-pull-request-${{ github.event.number }} >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Delete the release | ||
run: gh release delete '${{ env.betty_tag }}' --cleanup-tag --yes | ||
env: | ||
GH_TOKEN: ${{ github.token }} |