Skip to content

Update actions/setup-python action to v4 - autoclosed #6

Update actions/setup-python action to v4 - autoclosed

Update actions/setup-python action to v4 - autoclosed #6

on:
pull_request:
branches:
- master
push:
branches:
- master
tags:
- "*"
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: setup Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: install
run: pip install .
- name: run all checks
run: aws-quota-checker check all
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: eu-central-1
publish:
runs-on: ubuntu-latest
needs: test
if: success() && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v2
- name: setup Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: install
run: pip install .[dev]
- name: get changelog entry
id: changelog
run: python tools/extract-changelog-entry.py ${GITHUB_REF#refs/tags/} > changelog_entry
- name: build package
run: python setup.py bdist_wheel
- name: publish package
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: changelog_entry
build_and_push_docker_image:
runs-on: ubuntu-latest
needs: test
name: Build and push Docker image
steps:
- uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build Docker image
run: docker build . --tag ghcr.io/brennerm/aws-quota-checker:latest
- name: Push Docker image for branch
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }}
run: |
docker tag ghcr.io/brennerm/aws-quota-checker:latest ghcr.io/brennerm/aws-quota-checker:master
docker push ghcr.io/brennerm/aws-quota-checker:master
- name: Push Docker image for tag
if: ${{ startsWith(github.ref, 'refs/tags') && github.event_name == 'push' }}
run: |
docker tag ghcr.io/brennerm/aws-quota-checker:latest ghcr.io/brennerm/aws-quota-checker:${GITHUB_REF##*/}
docker push ghcr.io/brennerm/aws-quota-checker:latest
docker push ghcr.io/brennerm/aws-quota-checker:${GITHUB_REF##*/}