-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
57 additions
and
65 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,10 +116,7 @@ jobs: | |
publish: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
needs: [build, test] | ||
strategy: | ||
matrix: | ||
registry: ["docker.io", "ghcr.io"] | ||
needs: [build] | ||
if: >- | ||
github.repository == 'pspgen/build-machine' | ||
&& (github.ref_type == 'tag' || github.ref_name == 'main') | ||
|
@@ -134,14 +131,6 @@ jobs: | |
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Login to DockerHub 🔑 | ||
uses: docker/login-action@v3 | ||
if: inputs.registry == 'docker.io' | ||
with: | ||
registry: docker.io | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Read build variables | ||
id: build_vars | ||
run: | | ||
|
@@ -153,7 +142,7 @@ jobs: | |
uses: docker/metadata-action@v5 | ||
env: ${{ fromJSON(steps.build_vars.outputs.vars) }} | ||
with: | ||
images: ${{ matrix.registry }}/${{ github.repository_owner }}/build-machine | ||
images: ghcr.io/${{ github.repository_owner }}/build-machine | ||
tags: | | ||
type=edge,enable={{is_default_branch}} | ||
type=raw,value={{tag}},enable=${{ github.ref_type == 'tag' && ! startsWith(github.ref_name, 'v') }} | ||
|
@@ -162,23 +151,26 @@ jobs: | |
type=raw,value=lapack-${{ env.LAPACK_VERSION }},enable=${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }} | ||
type=match,pattern=v(\d{4}\.\d{4}(-.+)?),group=1 | ||
- name: Determine source image | ||
id: images | ||
- name: Parse digest name | ||
id: parse_digest | ||
run: | | ||
echo '${{ needs.build.outputs.image }}' | jq -r 'split("@") | {repository: .[0], digest: (.[1] | split(":")[1])}' > /tmp/parse_digest.json | ||
echo "repository=$(cat /tmp/parse_digest.json | jq -r '.repository')" | tee -a "${GITHUB_OUTPUT}" | ||
echo "digest=$(cat /tmp/parse_digest.json | jq -r '.digest')" | tee -a "${GITHUB_OUTPUT}" | ||
- name: Pull, tag and push | ||
id: retag | ||
run: | | ||
src=$(echo '${{ inputs.images }}'| jq -cr '.[("${{ matrix.target }}"|ascii_upcase|sub("-"; "_"; "g")) + "_IMAGE"]') | ||
echo "src=$src" | tee -a "${GITHUB_OUTPUT}" | ||
temp_tag=${{ steps.parse_digest.outputs.repository}}:${{ steps.parse_digest.outputs.digest }} | ||
- name: Push image | ||
docker pull ${{ needs.build.outputs.image }} | ||
docker tag ${{ needs.build.outputs.image }} ${temp_tag} | ||
docker push ${temp_tag} | ||
echo "temp_tag=${temp_tag}" | tee -a "${GITHUB_OUTPUT}" | ||
- name: Push tags | ||
uses: akhilerm/[email protected] | ||
with: | ||
src: ${{ needs.build.outputs.image }} | ||
src: ${{ steps.retag.outputs.temp_tag }} | ||
dst: ${{ steps.meta.outputs.tags }} | ||
|
||
- name: Docker Hub Description | ||
if: inputs.registry == 'docker.io' | ||
uses: peter-evans/dockerhub-description@v4 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
repository: pspgen/build-machine | ||
short-description: ${{ github.event.repository.description }} |
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