Fix snapcraft upload #51
Workflow file for this run
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: Publish package | |
on: | |
workflow_dispatch: | |
inputs: | |
release_tag: | |
type: string | |
required: true | |
description: The release tag to fetch the package to publish | |
workflow_call: | |
inputs: | |
release_tag: | |
type: string | |
required: true | |
description: The release tag to fetch the package to publish | |
release: | |
types: | |
- published | |
- edited | |
pull_request: | |
paths: | |
- .github/workflows/publish.yml | |
# We set `concurrency` to prevent having this workflow being run on code that is not up-to-date on a PR (a user make multiple push in a quick manner). | |
# But on the main branch, we don't want that behavior. | |
# Having the workflow run on each merge commit is something we would like, that could help us where a regression was made and missed by previous checks. | |
concurrency: | |
group: publish-package-${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
RELEASE_TAG: ${{ (github.event_name == 'release' && github.ref_name) || (github.event_name == 'pull_request' && 'nightly') || inputs.release_tag }} | |
jobs: | |
publish: | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- name: Get tag version | |
id: version | |
run: | | |
set -eux -o pipefail | |
gh release \ | |
--repo=${{ github.server_url }}/${{ github.repository }} \ | |
download \ | |
${{ env.RELEASE_TAG }} \ | |
--pattern=version \ | |
--output=- | tee -a $GITHUB_OUTPUT | |
env: | |
GH_TOKEN: ${{ github.token }} | |
timeout-minutes: 2 | |
- name: Download Wheels from release | |
run: | | |
mkdir dist | |
gh release \ | |
--repo=${{ github.server_url }}/${{ github.repository }} \ | |
download \ | |
${{ env.RELEASE_TAG }} \ | |
--pattern=parsec_cloud-${{ steps.version.outputs.pep440 }}-*.whl \ | |
--dir=dist | |
env: | |
GH_TOKEN: ${{ github.token }} | |
timeout-minutes: 2 | |
- name: Download snap from release | |
run: | | |
mkdir snap | |
gh release \ | |
--repo=${{ github.server_url }}/${{ github.repository }} \ | |
download \ | |
${{ env.RELEASE_TAG }} \ | |
--pattern=Parsec-v3_${{ steps.version.outputs.full }}_linux_*.snap \ | |
--dir=snap | |
env: | |
GH_TOKEN: ${{ github.token }} | |
timeout-minutes: 2 | |
- name: List downloaded files | |
run: tree dist snap | |
- name: Install Snapcraft | |
uses: samuelmeuli/action-snapcraft@d33c176a9b784876d966f80fb1b461808edc0641 # pin v2.1.1 | |
timeout-minutes: 2 | |
- name: Whoami snap | |
run: snapcraft whoami | |
env: | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_CREDENTIALS }} | |
timeout-minutes: 2 | |
- name: Upload Snap | |
run: snapcraft upload --release=nightly/stable snap/Parsec-v3_${{ steps.version.outputs.full }}_linux_*.snap | |
env: | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_CREDENTIALS }} | |
timeout-minutes: 2 | |
- name: Publish wheel on PyPI | |
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # pin v1.8.14 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_CREDENTIALS }} | |
timeout-minutes: 2 |