Skip to content

Commit

Permalink
Change: Use new container and release workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
timopollmeier authored and bjoernricks committed Jun 28, 2023
1 parent f8480c5 commit d28379e
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 64 deletions.
30 changes: 21 additions & 9 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ name: Container Image Builds

on:
push:
branches: [ main ]
branches:
- main
tags: ["v*"]
pull_request:
branches:
- main
workflow_dispatch:

jobs:
Expand All @@ -14,6 +18,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: greenbone/actions/is-latest-tag@v2
id: latest
- name: Setup container meta information
id: meta
uses: docker/metadata-action@v4
Expand All @@ -24,14 +30,20 @@ jobs:
org.opencontainers.image.base.name=debian/bullseye-slim
flavor: latest=false # no latest container tag for git tags
tags: |
# create container tag for git tags
type=ref,event=tag
# use latest for stable branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
type=raw,value=stable,enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
type=raw,value=oldstable,enable=${{ github.ref == format('refs/heads/{0}', 'oldstable') }}
# use unstable for main branch
type=raw,value=unstable,enable={{is_default_branch}}
# use version, major.minor and major for tags
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
# use edge for default branch
type=edge
# set label for non-published pull request builds
type=ref,event=pr
# when a new git tag is created set stable and a latest tags
type=raw,value=latest,enable=${{ steps.latest.outputs.is-latest-tag == 'true' }}
type=raw,value=stable,enable=${{ steps.latest.outputs.is-latest-tag == 'true' }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
Expand Down
21 changes: 2 additions & 19 deletions .github/workflows/deploy-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,5 @@ on:

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade poetry
python -m pip install --upgrade twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
poetry build
twine upload dist/*
uses: greenbone/workflows/.github/workflows/deploy-pypi.yml@main
secrets: inherit
28 changes: 0 additions & 28 deletions .github/workflows/release-pontos-manually.yml

This file was deleted.

46 changes: 38 additions & 8 deletions .github/workflows/release-pontos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,54 @@ name: Release Python package with pontos
on:
pull_request:
types: [closed]
workflow_dispatch:
inputs:
release-type:
type: choice
description: What kind of release do you want to do (pontos --release-type argument)?
options:
- patch
- minor
- major
release-version:
type: string
description: Set an explicit version, that will overwrite release-type. Fails if version is not compliant.


jobs:
build-and-release:
name: Build and release with pontos
# If the label 'make release' is set. If PR is closed because of an merge
if: contains( github.event.pull_request.labels.*.name, 'make release') && github.event.pull_request.merged == true
runs-on: "ubuntu-latest"
name: Create a new release
# If the event is a workflow_dispatch or on of the labels 'pre release',
# 'patch release', 'minor release' or 'major release' is set and PR is
# closed because of a merge
# NOTE: priority of set labes will be alpha > release-candidate > patch > minor > major,
# so if 'major' and 'patch' labes are set, it will create a patch release.
if: |
( github.event_name == 'workflow_dispatch') || (
( contains(github.event.pull_request.labels.*.name, 'alpha release') ||
contains(github.event.pull_request.labels.*.name, 'rc release') ||
contains(github.event.pull_request.labels.*.name, 'patch release') ||
contains(github.event.pull_request.labels.*.name, 'minor release') ||
contains(github.event.pull_request.labels.*.name, 'major release')) &&
github.event.pull_request.merged == true )
runs-on: 'ubuntu-latest'
steps:
- name: Selecting the Release type
id: release-type
uses: greenbone/actions/release-type@v2
with:
release-type-input: ${{ inputs.release-type }}
- name: Release with release action
uses: greenbone/actions/release@v2
with:
version: "3.10"
conventional-commits: true
ref: ${{ github.ref_name }}
python-version: "3.10"
github-user: ${{ secrets.GREENBONE_BOT }}
github-user-mail: ${{ secrets.GREENBONE_BOT_MAIL }}
github-user-token: ${{ secrets.GREENBONE_BOT_TOKEN }}
gpg-key: ${{ secrets.GPG_KEY }}
gpg-fingerprint: ${{ secrets.GPG_FINGERPRINT }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
strategy: calendar
release-type: ${{ steps.release-type.outputs.release-type }}
release-version: ${{ inputs.release-version }}
ref: ${{ steps.release-type.outputs.release-ref }}
versioning-scheme: "semver"

0 comments on commit d28379e

Please sign in to comment.