Skip to content

Commit 88bbccb

Browse files
authored
Tag GHCR latest only when publishing from develop branch (#887)
* Tag GHCR latest only when publishing from develop branch * Fix condition * Quote platforms * Fix output(s) typo
1 parent 92671db commit 88bbccb

File tree

1 file changed

+23
-35
lines changed

1 file changed

+23
-35
lines changed

.github/workflows/test-library.yml

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ jobs:
6767
sdist-artifact-name: ${{ steps.artifact-name.outputs.sdist }}
6868
wheel-artifact-name: ${{ steps.artifact-name.outputs.wheel }}
6969
container-version: v${{ steps.container.outputs.version }}
70+
container-platforms: ${{ steps.container.outputs.platforms }}
7071
steps:
7172
- name: Switch to using Python 3.9 by default
7273
uses: actions/setup-python@v2
@@ -204,7 +205,9 @@ jobs:
204205
&& github.event.inputs.release-version
205206
|| steps.scm-version.outputs.dist-version
206207
}}' | tr + .);
207-
echo "::set-output name=version::$VER"
208+
PLATFORMS="linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x";
209+
echo "::set-output name=version::$VER";
210+
echo "::set-output name=platforms::$PLATFORMS"
208211
209212
build:
210213
name: 👷 dists ${{ needs.pre-setup.outputs.git-tag }}
@@ -727,19 +730,32 @@ jobs:
727730
--local-executor && ./tests/integration/test_integration.sh 8899
728731
- name: Push to GHCR
729732
run: >-
730-
PLATFORMS=linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x;
731733
REGISTRY_URL="ghcr.io/abhinavsingh/proxy.py";
732734
CONTAINER_TAG=$REGISTRY_URL:${{
733735
needs.pre-setup.outputs.container-version
734736
}};
737+
docker buildx build
738+
--push
739+
--platform ${{
740+
needs.pre-setup.outputs.container-platforms
741+
}}
742+
--build-arg PROXYPY_PKG_PATH='dist/${{
743+
needs.pre-setup.outputs.wheel-artifact-name
744+
}}'
745+
-t $CONTAINER_TAG .
746+
- name: Tag latest on GHCR
747+
if: github.ref == 'ref/head/develop'
748+
run: >-
749+
REGISTRY_URL="ghcr.io/abhinavsingh/proxy.py";
735750
LATEST_TAG=$REGISTRY_URL:latest;
736751
docker buildx build
737752
--push
738-
--platform $PLATFORMS
753+
--platform ${{
754+
needs.pre-setup.outputs.container-platforms
755+
}}
739756
--build-arg PROXYPY_PKG_PATH='dist/${{
740757
needs.pre-setup.outputs.wheel-artifact-name
741758
}}'
742-
-t $CONTAINER_TAG
743759
-t $LATEST_TAG .
744760
- name: Login to DockerHub
745761
uses: docker/login-action@v1
@@ -748,14 +764,15 @@ jobs:
748764
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
749765
- name: Push to DockerHub
750766
run: >-
751-
PLATFORMS=linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x;
752767
REGISTRY_URL="abhinavsingh/proxy.py";
753768
CONTAINER_TAG=$REGISTRY_URL:${{
754769
needs.pre-setup.outputs.container-version
755770
}};
756771
docker buildx build
757772
--push
758-
--platform $PLATFORMS
773+
--platform ${{
774+
needs.pre-setup.outputs.container-platforms
775+
}}
759776
--build-arg PROXYPY_PKG_PATH='dist/${{
760777
needs.pre-setup.outputs.wheel-artifact-name
761778
}}'
@@ -839,35 +856,6 @@ jobs:
839856
password: ${{ secrets.TESTPYPI_API_TOKEN }}
840857
repository_url: https://test.pypi.org/legacy/
841858
842-
# publish-docker:
843-
# name: Publish 🐳 📦 ${{ needs.pre-setup.outputs.git-tag }} to Docker Hub
844-
# needs:
845-
# - check
846-
# - pre-setup # transitive, for accessing settings
847-
# if: >-
848-
# fromJSON(needs.pre-setup.outputs.release-requested)
849-
# runs-on: Ubuntu-latest
850-
851-
# environment:
852-
# name: release-docker
853-
# url: >-
854-
# https://test.pypi.org/project/proxy.py/${{
855-
# needs.pre-setup.outputs.dist-version
856-
# }}
857-
858-
# steps:
859-
# - name: Download all the dists
860-
# uses: actions/download-artifact@v2
861-
# with:
862-
# name: python-package-distributions
863-
# path: dist/
864-
# - name: >-
865-
# Publish 🐳 📦 ${{ needs.pre-setup.outputs.git-tag }} to Docker Hub
866-
# uses: pypa/gh-action-pypi-publish@release/v1
867-
# with:
868-
# password: ${{ secrets.TESTPYPI_API_TOKEN }}
869-
# repository_url: https://test.pypi.org/legacy/
870-
871859
post-release-repo-update:
872860
name: >-
873861
Publish post-release Git tag

0 commit comments

Comments
 (0)