Skip to content

Commit

Permalink
chore: update action
Browse files Browse the repository at this point in the history
  • Loading branch information
cooderl committed Feb 28, 2024
1 parent 31cb9f0 commit 1e22169
Showing 1 changed file with 50 additions and 12 deletions.
62 changes: 50 additions & 12 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 1e22169

Please sign in to comment.