main #56
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: main | |
on: | |
workflow_dispatch: #github页面手动触发 | |
push: #push即触发 | |
tags: | |
- "v*.*" | |
pull_request: | |
tags: | |
- "v*.*" | |
jobs: | |
review: | |
uses: twbworld/proxy/.github/workflows/review.yml@main | |
secrets: inherit #传递所有secrets, 被调用的不需要接收 | |
dependency-review: | |
if: github.base_ref != '' || github.head_ref != '' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/dependency-review-action@v3 | |
metadata: | |
runs-on: ubuntu-latest | |
outputs: | |
image-tags: ${{ steps.extract-metadata.outputs.tags }} | |
image-labels: ${{ steps.extract-metadata.outputs.labels }} | |
steps: | |
- id: extract-repo-name | |
run: | | |
repo_name="" | |
if [ -n "$GITHUB_REPOSITORY" ]; then | |
repo_name=${GITHUB_REPOSITORY#*/} | |
repo_name=${repo_name#*/} | |
repo_name=${repo_name#*docker-} | |
fi | |
echo "repo-name=${repo_name}" >> $GITHUB_OUTPUT | |
- id: extract-metadata | |
if: steps.extract-repo-name.outputs.repo-name && vars.DOCKERHUB_USERNAME | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
${{ vars.DOCKERHUB_USERNAME }}/${{ steps.extract-repo-name.outputs.repo-name }} | |
ghcr.io/${{ github.repository_owner }}/${{ steps.extract-repo-name.outputs.repo-name }} | |
#设置镜像tag | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
push-images: | |
needs: metadata | |
if: needs.metadata.outputs.image-tags | |
uses: twbworld/proxy/.github/workflows/push-images.yaml@main | |
secrets: inherit | |
with: | |
image-tags: ${{ needs.metadata.outputs.image-tags }} | |
image-labels: ${{ needs.metadata.outputs.image-labels }} | |
dockerhub-username: ${{ vars.DOCKERHUB_USERNAME }} |