Automate releases (#3732)
* Test custom action with custom input * Run test workflow on push * Automated release configuration
This commit is contained in:
parent
1579e44a27
commit
562d0eef69
3 changed files with 87 additions and 12 deletions
68
.github/workflows/release.yml
vendored
68
.github/workflows/release.yml
vendored
|
|
@ -1,21 +1,69 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version'
|
||||
required: true
|
||||
default: ''
|
||||
|
||||
jobs:
|
||||
hello_world_job:
|
||||
release-moto-job:
|
||||
runs-on: ubuntu-latest
|
||||
name: A job to say hello
|
||||
name: Release Moto
|
||||
env:
|
||||
VERSION: 0.0.0
|
||||
steps:
|
||||
- name: Hello world action step
|
||||
id: hello
|
||||
uses: bblommers/moto-release-action@v1
|
||||
- name: Set Env
|
||||
run: |
|
||||
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
who-to-greet: 'Mona the Octocat wants to release ${{ github.event.inputs.version }}'
|
||||
# Use the output from the `hello` step
|
||||
- name: Get the output time
|
||||
run: echo "The time was ${{ steps.hello.outputs.time }}"
|
||||
fetch-depth: 0
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.8
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install wheel setuptools packaging twine --upgrade
|
||||
- name: Verify Tag does not exist
|
||||
run: |
|
||||
! git rev-parse ${{ env.VERSION }} || { echo "Ensure that no tag exists for ${{ env.VERSION }}" ; exit 1; }
|
||||
- name: Verify supplied version exists in the CHANGELOG
|
||||
run: |
|
||||
grep ${{ env.VERSION }} CHANGELOG.md || { echo "Ensure that the CHANGELOG contains an entry for ${{ env.VERSION }}" ; exit 1; }
|
||||
- name: Set version number
|
||||
run: python update_version_from_git.py ${{ env.VERSION }}
|
||||
- name: Build
|
||||
run: python setup.py sdist bdist_wheel
|
||||
- name: Publish to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@master
|
||||
with:
|
||||
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||
- name: Tag version on Github
|
||||
run: |
|
||||
git tag ${{ env.VERSION }}
|
||||
git push origin ${{ env.VERSION }}
|
||||
- name: Build Docker release
|
||||
run: |
|
||||
docker build -t motoserver/moto . --tag moto:${{ env.VERSION }}
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
tags: motoserver/moto:${{ env.VERSION }}
|
||||
- name: Increase patch version number
|
||||
run: |
|
||||
python update_version_from_git.py patch
|
||||
git config --local user.email "admin@getmoto.org"
|
||||
git config --local user.name "Moto Admin"
|
||||
git add moto/__init__.py
|
||||
git commit -m "Increase version number post-release"
|
||||
git push
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue