Admin: Allow different release tracks

This commit is contained in:
Bert Blommers 2023-11-17 21:18:33 -01:00
parent deeddfb72b
commit e1738d7363

View File

@ -6,6 +6,10 @@ on:
version: version:
description: 'Version' description: 'Version'
required: true required: true
current_release:
description: 'True to release Docker and update version info in moto/__init__.py'
required: true
type: boolean
jobs: jobs:
release-moto-job: release-moto-job:
@ -44,9 +48,11 @@ jobs:
- name: Build Python - name: Build Python
run: python -m build run: python -m build
- name: Build Docker release - name: Build Docker release
if: ${{ inputs.current_release }}
run: | run: |
docker build -t motoserver/moto . --tag moto:${{ env.VERSION }} docker build -t motoserver/moto . --tag moto:${{ env.VERSION }}
- name: Test Docker release - name: Test Docker release
if: ${{ inputs.current_release }}
run: | run: |
docker run -p 5000:5000 --name moto motoserver/moto & docker run -p 5000:5000 --name moto motoserver/moto &
TEST_SERVER_MODE=true pytest -sv tests/test_core tests/test_s3/test_s3.py TEST_SERVER_MODE=true pytest -sv tests/test_core tests/test_s3/test_s3.py
@ -66,21 +72,26 @@ jobs:
# Required to get the correct Digest # Required to get the correct Digest
# See https://github.com/docker/build-push-action/issues/461 # See https://github.com/docker/build-push-action/issues/461
- name: Set up QEMU - name: Set up QEMU
if: ${{ inputs.current_release }}
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
if: ${{ inputs.current_release }}
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Login to DockerHub - name: Login to DockerHub
if: ${{ inputs.current_release }}
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GHCR - name: Login to GHCR
if: ${{ inputs.current_release }}
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to DockerHub and GHCR - name: Push to DockerHub and GHCR
if: ${{ inputs.current_release }}
id: build_and_push id: build_and_push
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
@ -90,6 +101,7 @@ jobs:
motoserver/moto:${{ env.VERSION }} motoserver/moto:${{ env.VERSION }}
ghcr.io/getmoto/motoserver:${{ env.VERSION }} ghcr.io/getmoto/motoserver:${{ env.VERSION }}
- name: Increase patch version number - name: Increase patch version number
if: ${{ inputs.current_release }}
run: | run: |
python update_version_from_git.py patch python update_version_from_git.py patch
sed -i 's/Docker Digest for ${{ env.VERSION }}: <autopopulateddigest>/Docker Digest for ${{ env.VERSION }}: _${{ steps.build_and_push.outputs.digest }}_/' CHANGELOG.md sed -i 's/Docker Digest for ${{ env.VERSION }}: <autopopulateddigest>/Docker Digest for ${{ env.VERSION }}: _${{ steps.build_and_push.outputs.digest }}_/' CHANGELOG.md