Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
docker:
name: Build and push image
runs-on: ubuntu-latest
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
# 拒绝在非 v* ref 上误跑(例如 UI 里对 main 点 Run workflow)
if: startsWith(github.ref, 'refs/tags/v')
steps:
Expand Down Expand Up @@ -59,11 +62,11 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
if: ${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }}
if: ${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ env.DOCKERHUB_TOKEN }}

- name: Log in to GHCR
uses: docker/login-action@v3
Expand All @@ -74,15 +77,13 @@ jobs:

- name: Image names
id: image
env:
HUB_USER: ${{ secrets.DOCKERHUB_USERNAME }}
run: |
set -euo pipefail
ghcr="ghcr.io/$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')"
echo "ghcr=${ghcr}" >> "$GITHUB_OUTPUT"
images="${ghcr}"
if [ -n "${HUB_USER}" ]; then
hub="${HUB_USER}/freeos"
if [ -n "${DOCKERHUB_USERNAME}" ]; then
hub="${DOCKERHUB_USERNAME}/freeos"
echo "hub=${hub}" >> "$GITHUB_OUTPUT"
images="${images}"$'\n'"${hub}"
else
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
permissions:
contents: write
actions: write
id-token: write

concurrency:
group: release-${{ github.ref }}
Expand Down
Loading