Integrate automatic releases. (#1315)

This commit is contained in:
Batuhan Taskaya 2022-03-09 15:26:51 +03:00 committed by GitHub
parent 8efa7cb04d
commit a5288f0cd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 126 additions and 40 deletions

26
.github/workflows/release-brew.yml vendored Normal file
View File

@ -0,0 +1,26 @@
name: Release on Homebrew
on:
workflow_dispatch:
inputs:
branch:
description: "The branch, tag or SHA to release from"
required: true
default: "master"
jobs:
brew-release:
name: Release the Homebrew Package
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.branch }}
- uses: mislav/bump-homebrew-formula-action@v1
with:
formula-name: httpie
tag-name: ${{ github.events.inputs.branch }}
env:
COMMITTER_TOKEN: ${{ secrets.BREW_UPDATE_TOKEN }}

48
.github/workflows/release-choco.yml vendored Normal file
View File

@ -0,0 +1,48 @@
name: Release on Chocolatey
on:
workflow_dispatch:
inputs:
branch:
description: "The branch, tag or SHA to release from"
required: true
default: "master"
jobs:
brew-release:
name: Release the Chocolatey
runs-on: windows-2019
env:
package-dir: ./httpie/docs/packaging/windows-chocolatey
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.branch }}
# Chocolatey comes already installed on the Windows GHA image
- name: Build the Choco package
shell: cmd
run: choco pack -v
working-directory: ${{ env.package-dir }}
- name: Check the Choco package
run: choco info httpie -s .
working-directory: ${{ env.package-dir }}
- name: Check the Installation
run: |
choco install httpie -y -dv -s "'.;https://community.chocolatey.org/api/v2/'"
http --version
https --version
httpie --version
choco uninstall -y httpie
working-directory: ${{ env.package-dir }}
- name: Publish on Chocolatey
shell: bash
env:
CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }}
run: |
choco apikey --key $CHOCO_API_KEY --source https://push.chocolatey.org/
choco push httpie*.nupkg --source https://push.chocolatey.org/

33
.github/workflows/release-pypi.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: Release on PyPI
on:
workflow_dispatch:
inputs:
branch:
description: "The branch, tag or SHA to release from"
required: true
default: "master"
jobs:
pypi-build-and-release:
name: Build and Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.branch }}
- uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Install pypa/build
run: python -m pip install build
- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/
- name: Release on PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_TOKEN }}

View File

@ -1,4 +1,4 @@
name: Release snap
name: Release on Snap
on:
workflow_dispatch:
@ -7,22 +7,34 @@ on:
description: "The branch, tag or SHA to release from"
required: true
default: "master"
level:
description: "Release level: stable, candidate, beta, edge"
required: true
default: "edge"
jobs:
snap:
snap-build-and-release:
name: Build & Release the Snap Package
runs-on: ubuntu-latest
strategy:
# If any of the stages fail, then we'll stop the action
# to give release manager time to investigate the underyling
# issue.
fail-fast: true
matrix:
level: [edge, beta, candidate, stable]
# Set the concurrency level for this version, so
# that we'll release one by one.
concurrency: ${{ github.event.inputs.branch }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.branch }}
- uses: snapcore/action-build@v1
id: build
- uses: snapcore/action-publish@v1
with:
store_login: ${{ secrets.SNAP_STORE_LOGIN }}
snap: ${{ steps.build.outputs.snap }}
release: ${{ github.event.inputs.level }}
release: ${{ matrix.level }}

View File

@ -1,33 +0,0 @@
name: Release on PyPI
on:
# Add a "Trigger" button to manually start the workflow.
workflow_dispatch:
inputs:
branch:
description: "The branch, tag or SHA to release from"
required: true
default: "master"
# It could be fully automated by uncommenting following lines.
# Let's see later if we are confident enough to try it :)
# release:
# types:
# - published
jobs:
new-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.branch }}
- name: PyPI configuration
run: |
echo "[distutils]\nindex-servers=\n httpie\n\n[httpie]\nrepository = https://upload.pypi.org/legacy/\n" > $HOME/.pypirc
- uses: actions/setup-python@v3
with:
python-version: 3.9
- run: make publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}