From a5288f0cd6fd84da655ef6c1366ba93f2ccd5ada Mon Sep 17 00:00:00 2001 From: Batuhan Taskaya Date: Wed, 9 Mar 2022 15:26:51 +0300 Subject: [PATCH] Integrate automatic releases. (#1315) --- .github/workflows/release-brew.yml | 26 ++++++++++++++++ .github/workflows/release-choco.yml | 48 +++++++++++++++++++++++++++++ .github/workflows/release-pypi.yml | 33 ++++++++++++++++++++ .github/workflows/release-snap.yml | 26 +++++++++++----- .github/workflows/release.yml | 33 -------------------- 5 files changed, 126 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/release-brew.yml create mode 100644 .github/workflows/release-choco.yml create mode 100644 .github/workflows/release-pypi.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release-brew.yml b/.github/workflows/release-brew.yml new file mode 100644 index 00000000..44de0b6f --- /dev/null +++ b/.github/workflows/release-brew.yml @@ -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 }} diff --git a/.github/workflows/release-choco.yml b/.github/workflows/release-choco.yml new file mode 100644 index 00000000..09b5393d --- /dev/null +++ b/.github/workflows/release-choco.yml @@ -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/ diff --git a/.github/workflows/release-pypi.yml b/.github/workflows/release-pypi.yml new file mode 100644 index 00000000..f11b830c --- /dev/null +++ b/.github/workflows/release-pypi.yml @@ -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 }} diff --git a/.github/workflows/release-snap.yml b/.github/workflows/release-snap.yml index 149adc50..afb22e84 100644 --- a/.github/workflows/release-snap.yml +++ b/.github/workflows/release-snap.yml @@ -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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 30561369..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -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 }}