chore: update action

This commit is contained in:
cooder
2024-02-28 21:54:10 +08:00
parent 31cb9f083f
commit 1e221693a4
+50 -12
View File
@@ -1,4 +1,4 @@
name: Build WeWeRSS images and push image to docker hub
name: Build WeWeRSS Server images and push image to docker hub
on:
workflow_dispatch:
push:
@@ -7,12 +7,13 @@ on:
- "Dockerfile"
tags:
- "v*.*.*"
concurrency:
group: docker-release-${{ github.ref }}
cancel-in-progress: true
jobs:
build-images:
setup-deps:
runs-on: ubuntu-20.04
steps:
- name: Checkout
@@ -28,6 +29,11 @@ jobs:
uses: docker/setup-buildx-action@v2
with:
driver-opts: network=host
build-web-images:
needs: setup-deps
runs-on: ubuntu-20.04
steps:
- name: Cache Docker layers
uses: actions/cache@v2
with:
@@ -41,14 +47,6 @@ jobs:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_NAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
# web
- name: Set DOCKER_REPO_TAGGED based on branch or tag
run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then
@@ -73,6 +71,18 @@ jobs:
-f Dockerfile \
.
push-web-images-to-docker-hub:
needs: build-web-images
runs-on: ubuntu-20.04
if: github.repository == 'cooderl/wewe-rss-web'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_NAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Set DOCKER_REPO_TAGGED based on branch or tag
run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then
@@ -87,7 +97,23 @@ jobs:
- name: Push image to Docker Hub
run: docker push ${{ github.repository_owner }}/wewe-rss-web:${{env.IMAGE_TAG}}
# server
build-server-images:
needs: setup-deps
runs-on: ubuntu-20.04
steps:
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set DOCKER_REPO_TAGGED based on branch or tag
run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then
@@ -105,13 +131,25 @@ jobs:
--label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/wewe-rss-server" \
--label "org.opencontainers.image.description=wewe-rss server image" \
--push \
--target web \
--target server \
--cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache \
-t ${DOCKER_REPO_TAGGED} \
-f Dockerfile \
.
push-server-images-to-docker-hub:
needs: build-server-images
runs-on: ubuntu-20.04
if: github.repository == 'cooderl/wewe-rss-server'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_NAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Set DOCKER_REPO_TAGGED based on branch or tag
run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then