2021-03-03 09:06:22 +00:00
|
|
|
name: Release
|
|
|
|
|
2021-02-24 14:42:22 +00:00
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
version:
|
|
|
|
description: 'Version'
|
|
|
|
required: true
|
2023-11-17 22:18:33 +00:00
|
|
|
current_release:
|
|
|
|
description: 'True to release Docker and update version info in moto/__init__.py'
|
|
|
|
required: true
|
|
|
|
type: boolean
|
2021-02-24 14:42:22 +00:00
|
|
|
|
|
|
|
jobs:
|
2021-03-03 09:06:22 +00:00
|
|
|
release-moto-job:
|
2021-02-24 14:42:22 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-03-03 09:06:22 +00:00
|
|
|
name: Release Moto
|
2023-09-02 21:11:07 +00:00
|
|
|
permissions:
|
|
|
|
contents: write
|
2023-11-10 22:44:59 +00:00
|
|
|
id-token: write
|
2023-09-16 18:04:49 +00:00
|
|
|
packages: write
|
2021-03-03 09:06:22 +00:00
|
|
|
env:
|
|
|
|
VERSION: 0.0.0
|
2021-02-24 14:42:22 +00:00
|
|
|
steps:
|
2021-03-03 09:06:22 +00:00
|
|
|
- name: Set Env
|
|
|
|
run: |
|
|
|
|
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
|
2023-09-05 17:33:10 +00:00
|
|
|
- uses: actions/checkout@v4
|
2021-03-03 09:06:22 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python 3.8
|
2023-12-11 23:47:25 +00:00
|
|
|
uses: actions/setup-python@v5
|
2021-03-03 09:06:22 +00:00
|
|
|
with:
|
|
|
|
python-version: 3.8
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
2023-01-06 19:43:16 +00:00
|
|
|
pip install wheel setuptools packaging twine build --upgrade
|
2023-08-23 09:28:44 +00:00
|
|
|
pip install -r requirements-dev.txt
|
2021-03-03 09:06:22 +00:00
|
|
|
- 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 }}
|
2023-08-23 07:28:42 +00:00
|
|
|
- name: Build Python
|
2023-01-06 19:43:16 +00:00
|
|
|
run: python -m build
|
2023-08-23 07:28:42 +00:00
|
|
|
- name: Build Docker release
|
2023-11-17 22:18:33 +00:00
|
|
|
if: ${{ inputs.current_release }}
|
2023-08-23 07:28:42 +00:00
|
|
|
run: |
|
|
|
|
docker build -t motoserver/moto . --tag moto:${{ env.VERSION }}
|
|
|
|
- name: Test Docker release
|
2023-11-17 22:18:33 +00:00
|
|
|
if: ${{ inputs.current_release }}
|
2023-08-23 07:28:42 +00:00
|
|
|
run: |
|
|
|
|
docker run -p 5000:5000 --name moto motoserver/moto &
|
2023-08-23 09:39:23 +00:00
|
|
|
TEST_SERVER_MODE=true pytest -sv tests/test_core tests/test_s3/test_s3.py
|
2023-08-23 07:28:42 +00:00
|
|
|
docker stop moto
|
2021-03-03 09:06:22 +00:00
|
|
|
- name: Publish to PyPI
|
2022-08-25 19:03:30 +00:00
|
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
2021-03-03 09:06:22 +00:00
|
|
|
- name: Tag version on Github
|
|
|
|
run: |
|
|
|
|
git tag ${{ env.VERSION }}
|
|
|
|
git push origin ${{ env.VERSION }}
|
2023-09-02 21:11:07 +00:00
|
|
|
- name: Create GitHub release
|
2024-03-12 09:46:39 +00:00
|
|
|
uses: softprops/action-gh-release@v2
|
2023-09-02 21:11:07 +00:00
|
|
|
with:
|
2023-09-02 21:25:26 +00:00
|
|
|
name: ${{ env.VERSION }}
|
|
|
|
tag_name: ${{ env.VERSION }}
|
2023-09-02 21:11:07 +00:00
|
|
|
files: dist/*
|
2022-02-18 11:54:58 +00:00
|
|
|
# Required to get the correct Digest
|
|
|
|
# See https://github.com/docker/build-push-action/issues/461
|
2022-10-11 17:22:02 +00:00
|
|
|
- name: Set up QEMU
|
2023-11-17 22:18:33 +00:00
|
|
|
if: ${{ inputs.current_release }}
|
2023-09-19 07:43:09 +00:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2022-02-18 11:54:58 +00:00
|
|
|
- name: Set up Docker Buildx
|
2023-11-17 22:18:33 +00:00
|
|
|
if: ${{ inputs.current_release }}
|
2023-09-19 07:42:34 +00:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2021-03-03 09:06:22 +00:00
|
|
|
- name: Login to DockerHub
|
2023-11-17 22:18:33 +00:00
|
|
|
if: ${{ inputs.current_release }}
|
2023-09-19 07:43:57 +00:00
|
|
|
uses: docker/login-action@v3
|
2021-03-03 09:06:22 +00:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
2023-03-16 21:22:02 +00:00
|
|
|
- name: Login to GHCR
|
2023-11-17 22:18:33 +00:00
|
|
|
if: ${{ inputs.current_release }}
|
2023-09-19 07:43:57 +00:00
|
|
|
uses: docker/login-action@v3
|
2023-03-16 21:22:02 +00:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Push to DockerHub and GHCR
|
2023-11-17 22:18:33 +00:00
|
|
|
if: ${{ inputs.current_release }}
|
2023-03-22 23:00:50 +00:00
|
|
|
id: build_and_push
|
2023-09-19 07:44:36 +00:00
|
|
|
uses: docker/build-push-action@v5
|
2021-02-24 14:42:22 +00:00
|
|
|
with:
|
2022-10-11 17:22:02 +00:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2021-03-03 09:06:22 +00:00
|
|
|
push: true
|
2023-03-16 21:22:02 +00:00
|
|
|
tags: |
|
|
|
|
motoserver/moto:${{ env.VERSION }}
|
|
|
|
ghcr.io/getmoto/motoserver:${{ env.VERSION }}
|
2021-03-03 09:06:22 +00:00
|
|
|
- name: Increase patch version number
|
2023-11-17 22:18:33 +00:00
|
|
|
if: ${{ inputs.current_release }}
|
2021-03-03 09:06:22 +00:00
|
|
|
run: |
|
|
|
|
python update_version_from_git.py patch
|
2022-02-18 11:54:58 +00:00
|
|
|
sed -i 's/Docker Digest for ${{ env.VERSION }}: <autopopulateddigest>/Docker Digest for ${{ env.VERSION }}: _${{ steps.build_and_push.outputs.digest }}_/' CHANGELOG.md
|
2021-03-03 09:06:22 +00:00
|
|
|
git config --local user.email "admin@getmoto.org"
|
|
|
|
git config --local user.name "Moto Admin"
|
|
|
|
git add moto/__init__.py
|
2022-02-18 11:54:58 +00:00
|
|
|
git add CHANGELOG.md
|
|
|
|
git commit -m "Post-release steps"
|
2021-03-03 09:06:22 +00:00
|
|
|
git push
|