ci: update GitHub workflows

This commit is contained in:
MuXiu1997
2023-01-25 21:31:09 +08:00
parent d1943d10e2
commit 4feae28073
2 changed files with 82 additions and 16 deletions

View File

@@ -1,16 +0,0 @@
on:
push:
branches:
- main
name: release-please
jobs:
release-please:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
with:
release-type: go
package-name: traefik-github-oauth-plugin

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

@@ -0,0 +1,82 @@
name: Release
on:
push:
branches:
- main
jobs:
release:
name: Release
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Release
id: release
uses: google-github-actions/release-please-action@v3
with:
release-type: go
package-name: traefik-github-oauth-plugin
- name: Setup Go
if: ${{ steps.release.outputs.release_created }}
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Checkout
if: ${{ steps.release.outputs.release_created }}
uses: actions/checkout@v2
with:
ref: ${{ steps.release.outputs.tag_name }}
- name: Build
if: ${{ steps.release.outputs.release_created }}
run: make
- name: Upload Release Assets
if: ${{ steps.release.outputs.release_created }}
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload ${{ steps.release.outputs.tag_name }} dist/*
# region Docker
- name: Set up Docker Buildx
if: ${{ steps.release.outputs.release_created }}
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
if: ${{ steps.release.outputs.release_created }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build And Push Docker Images
if: ${{ steps.release.outputs.release_created }}
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: |
muxiu1997/traefik-github-oauth-server:${{ steps.release.outputs.tag_name }}
muxiu1997/traefik-github-oauth-server:latest
- name: Replace The Relative Path In The README.md
if: ${{ steps.release.outputs.release_created }}
run: |
sed -E 's#(\[[^]]*\])\(\.\/([^)]+)\)#\1(https://github.com/${{ github.repository }}/raw/${{ steps.release.outputs.tag_name }}/\2)#g' README.md > docker.README.md
- name: Update Docker Images Description
if: ${{ steps.release.outputs.release_created }}
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: muxiu1997/traefik-github-oauth-server
short-description: server for traefik-github-oauth-plugin
readme-filepath: docker.README.md
# endregion Docker