mirror of
https://github.com/pesde-pkg/pesde.git
synced 2025-05-04 10:33:47 +01:00
refactor: merge docker image publish back into release
This commit is contained in:
parent
267b4bd688
commit
cb651d52e5
2 changed files with 64 additions and 80 deletions
80
.github/workflows/registry.yaml
vendored
80
.github/workflows/registry.yaml
vendored
|
@ -1,80 +0,0 @@
|
|||
name: Release Registry
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
prepare:
|
||||
name: Extract relevant information
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Read Cargo TOML
|
||||
uses: SebRollen/toml-action@v1.0.2
|
||||
id: read_toml
|
||||
with:
|
||||
file: "./registry/Cargo.toml"
|
||||
field: "package.version"
|
||||
|
||||
- name: Lowercase repository owner
|
||||
uses: ASzc/change-string-case-action@v6
|
||||
id: repository_owner
|
||||
with:
|
||||
string: ${{ github.repository_owner }}
|
||||
|
||||
outputs:
|
||||
version: ${{ steps.read_toml.outputs.value }}
|
||||
registry_image: "ghcr.io/${{ steps.repository_owner.outputs.lowercase }}/registry"
|
||||
|
||||
publish-registry-image:
|
||||
name: Build and publish Docker package
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ prepare ]
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
env:
|
||||
VERSION: ${{ needs.prepare.outputs.version }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: https://ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set Tags
|
||||
id: set_tags
|
||||
shell: bash
|
||||
run: |
|
||||
TAGS=$({
|
||||
echo "${{ needs.prepare.outputs.registry_image }}:${{ github.sha }}"
|
||||
echo "${{ needs.prepare.outputs.registry_image }}:${{ needs.prepare.outputs.version }}"
|
||||
if [[ "${{ needs.prepare.outputs.version }}" != *"-"* ]]; then
|
||||
echo "${{ needs.prepare.outputs.registry_image }}:latest"
|
||||
fi
|
||||
})
|
||||
echo "tags<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "$TAGS" >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.set_tags.outputs.tags }}
|
64
.github/workflows/release.yaml
vendored
64
.github/workflows/release.yaml
vendored
|
@ -12,6 +12,8 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version: ${{ steps.extract_version.outputs.VERSION }}
|
||||
version_registry: ${{ steps.extract_version_registry.outputs.value }}
|
||||
registry_image: "ghcr.io/${{ steps.repository_owner.outputs.lowercase }}/registry"
|
||||
found: ${{ steps.ensure_not_published.outputs.FOUND }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
@ -22,6 +24,19 @@ jobs:
|
|||
VERSION=$(echo ${{ github.ref_name }} | cut -d'+' -f1 | cut -c 2-)
|
||||
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Extract registry version
|
||||
uses: SebRollen/toml-action@v1.0.2
|
||||
id: extract_version_registry
|
||||
with:
|
||||
file: "./registry/Cargo.toml"
|
||||
field: "package.version"
|
||||
|
||||
- name: Lowercase repository owner
|
||||
uses: ASzc/change-string-case-action@v6
|
||||
id: repository_owner
|
||||
with:
|
||||
string: ${{ github.repository_owner }}
|
||||
|
||||
- name: Ensure not published
|
||||
id: ensure_not_published
|
||||
shell: bash
|
||||
|
@ -150,3 +165,52 @@ jobs:
|
|||
draft: true
|
||||
prerelease: ${{ startsWith(env.VERSION, '0') }}
|
||||
files: artifacts/*
|
||||
|
||||
publish-registry-image:
|
||||
name: Build and publish Docker package
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ prepare ]
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
env:
|
||||
VERSION: ${{ needs.prepare.outputs.version }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: https://ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set Tags
|
||||
id: set_tags
|
||||
shell: bash
|
||||
run: |
|
||||
TAGS=$({
|
||||
echo "${{ needs.prepare.outputs.registry_image }}:${{ github.sha }}"
|
||||
echo "${{ needs.prepare.outputs.registry_image }}:${{ needs.prepare.outputs.version }}"
|
||||
if [[ "${{ needs.prepare.outputs.version }}" != *"-"* ]]; then
|
||||
echo "${{ needs.prepare.outputs.registry_image }}:latest"
|
||||
fi
|
||||
})
|
||||
echo "tags<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "$TAGS" >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.set_tags.outputs.tags }}
|
Loading…
Add table
Reference in a new issue