Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 40 additions & 63 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,79 +5,56 @@ name: Upload Python Package

on:
workflow_dispatch:
push:
branches:
- v1
release:
types: [published]

env:
IMAGE_NAME: cloudbees/launchable

jobs:
tagpr:
permissions:
actions: write
contents: write
pull-requests: write
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.run-tagpr.outputs.tag }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- id: run-tagpr
uses: Songmu/tagpr@7191605433b03e11b313dbbc0efb80185170de4b # v1.9.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pypi:
needs: tagpr
if: needs.tagpr.outputs.tag != '' || github.event_name == 'workflow_dispatch'

if: github.event_name != 'release' || startsWith(github.event.release.tag_name, 'v1')
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
# build and publish package using GitHub Actions workflow
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
# actual publish
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Actions for Discord
uses: Ilshidur/action-discord@0.3.2
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
args: 'Launchable CLI ${{ needs.tagpr.outputs.tag }} is released! https://github.com/cloudbees-oss/smart-tests-cli/releases/tag/${{ needs.tagpr.outputs.tag }}'

- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
# build and publish package using GitHub Actions workflow
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
# actual publish
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Actions for Discord
uses: Ilshidur/action-discord@0.3.2
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
args: "Launchable CLI ${{ github.event.release.tag_name }} is released! ${{ github.event.release.html_url }}"
docker:
if: github.event_name != 'release' || startsWith(github.event.release.tag_name, 'v1')
name: Push Docker image to Docker Hub
needs: tagpr
if: needs.tagpr.outputs.tag != '' || github.event_name == 'workflow_dispatch'

runs-on: ubuntu-22.04

permissions:
packages: write
contents: read
Expand All @@ -104,7 +81,7 @@ jobs:
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.IMAGE_NAME }}:${{ needs.tagpr.outputs.tag }}
tags: ${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}

- name: Generate artifact attestation
uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2.4.0
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,16 @@ pipenv install --dev some-what-module

# How to release

Create new release on Github, then Github Actions automatically uploads the
1. Create a new tag for the next release locally

```sh
git checkout v1
git pull
git tag v1.xx.yy
git push origin --tags
```

2. Create new release on Github, then Github Actions automatically uploads the
module to PyPI.

## How to update launchable/jar/exe_deploy.jar
Expand Down
Loading