👷 Automate release process. Restructure workflows

This commit is contained in:
Lars Gohr
2022-04-14 17:50:10 +02:00
parent a28c5ceb1c
commit 474524bd74
6 changed files with 65 additions and 50 deletions

View File

@@ -2,7 +2,7 @@ name: Dependabot auto-merge
on:
pull_request_target:
branches: [ master ]
branches: [ main ]
types: [ opened ]
permissions:

63
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,63 @@
name: Release
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build .
integration-test-github:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Publish to Registry
if: ${{ github.actor != 'dependabot[bot]' }}
uses: elgohr/Publish-Docker-Github-Action@main
with:
name: docker.pkg.github.com/elgohr/publish-docker-github-action/publish-docker-github-action
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
integration-test-dockerhub:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
permissions:
contents: read
steps:
- uses: actions/checkout@v3
- name: Publish to Registry
if: ${{ github.actor != 'dependabot[bot]' }}
uses: elgohr/Publish-Docker-Github-Action@main
with:
name: lgohr/publish-docker-github-action
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
snapshot: true
tag_names: true
release:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
needs:
- test
- integration-test-github
- integration-test-dockerhub
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.PUBLISH_TOKEN }} # for pushing to protected branch
- name: Publish new version
run: |
git config --global user.email "no_reply@gohr.digital"
git config --global user.name "Release Bot"
git tag -fa v4 -m "Update v4 tag"
git push origin v4 --force

View File

@@ -1,9 +0,0 @@
name: Test
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build .

View File

@@ -1,19 +0,0 @@
name: Integration Test
on:
push:
branches:
- main
jobs:
integration-test-dockerhub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Publish to Registry
if: ${{ github.actor != 'dependabot[bot]' }}
uses: elgohr/Publish-Docker-Github-Action@main
with:
name: lgohr/publish-docker-github-action
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
snapshot: true
tag_names: true

View File

@@ -1,18 +0,0 @@
name: Integration Test Github
on:
push:
branches:
- main
jobs:
integration-test-github:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Publish to Registry
if: ${{ github.actor != 'dependabot[bot]' }}
uses: elgohr/Publish-Docker-Github-Action@main
with:
name: docker.pkg.github.com/elgohr/publish-docker-github-action/publish-docker-github-action
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com

View File

@@ -1,7 +1,5 @@
# Publishes docker containers
[![Actions Status](https://github.com/elgohr/Publish-Docker-Github-Action/workflows/Test/badge.svg)](https://github.com/elgohr/Publish-Docker-Github-Action/actions)
[![Actions Status](https://github.com/elgohr/Publish-Docker-Github-Action/workflows/Integration%20Test/badge.svg)](https://github.com/elgohr/Publish-Docker-Github-Action/actions)
[![Actions Status](https://github.com/elgohr/Publish-Docker-Github-Action/workflows/Integration%20Test%20Github/badge.svg)](https://github.com/elgohr/Publish-Docker-Github-Action/actions)
[![Test](https://github.com/elgohr/Publish-Docker-Github-Action/actions/workflows/release.yml/badge.svg)](https://github.com/elgohr/Publish-Docker-Github-Action/actions/workflows/release.yml)
This Action for [Docker](https://www.docker.com/) uses the Git branch as the [Docker tag](https://docs.docker.com/engine/reference/commandline/tag/) for building and pushing the container.
Hereby the master-branch is published as the latest-tag.