44 push :
55 tags :
66 - ' *'
7+ workflow_dispatch :
8+ inputs :
9+ version :
10+ description : ' Version to release (tag name)'
11+ required : true
712
813permissions :
914 contents : write
@@ -16,17 +21,22 @@ jobs:
1621 version : ${{ steps.version.outputs.version }}
1722 digest : ${{ steps.docker_build.outputs.digest }}
1823 steps :
19- - uses : actions/checkout@v4
20- with :
21- fetch-depth : 0
22-
23- - name : Get version from tag
24+ - name : Determine version
2425 id : version
2526 run : |
26- version="${GITHUB_REF_NAME}"
27+ if [ -n "${{ inputs.version }}" ]; then
28+ version="${{ inputs.version }}"
29+ else
30+ version="${GITHUB_REF_NAME}"
31+ fi
2732 echo "version=${version}" >> "$GITHUB_OUTPUT"
2833 echo "Releasing version: ${version}"
2934
35+ - uses : actions/checkout@v4
36+ with :
37+ ref : ${{ steps.version.outputs.version }}
38+ fetch-depth : 0
39+
3040 - name : Set up QEMU
3141 uses : docker/setup-qemu-action@v3
3242
5868 tags="${tags},${{ secrets.DOCKER_USERNAME }}/nsenter:latest"
5969 fi
6070 echo "tags=${tags}" >> "$GITHUB_OUTPUT"
61- echo "Image tags: ${tags}"
6271
6372 - name : Build and push multi-arch image
6473 id : docker_build
8291 - name : Run integration tests against released image
8392 run : |
8493 chmod +x tests/test-docker.sh
85- TEST_IMAGE=ghcr.io/${{ github.repository_owner }}/nsenter:latest ./tests/test-docker.sh
94+ TEST_IMAGE=ghcr.io/${{ github.repository_owner }}/nsenter:${{ needs.build.outputs.version }} ./tests/test-docker.sh
8695
8796 github-release :
8897 runs-on : ubuntu-latest
@@ -95,12 +104,12 @@ jobs:
95104 - name : Get previous tag
96105 id : prev_tag
97106 run : |
98- prev=$(git tag --sort=-creatordate | sed -n '2p' || echo "")
107+ prev=$(git tag --sort=-v:refname | sed -n '2p' || echo "")
99108 echo "prev_tag=${prev}" >> "$GITHUB_OUTPUT"
100109
101110 - name : Generate release notes
102111 run : |
103- version="${GITHUB_REF_NAME }"
112+ version="${{ needs.build.outputs.version } }"
104113 prev="${{ steps.prev_tag.outputs.prev_tag }}"
105114 digest="${{ needs.build.outputs.digest }}"
106115
@@ -114,7 +123,9 @@ jobs:
114123 echo "| Registry | Image | Pull Command |"
115124 echo "|----------|-------|-------------|"
116125 echo "| **GHCR** | \`ghcr.io/alexei-led/nsenter:${version}\` | \`docker pull ghcr.io/alexei-led/nsenter:${version}\` |"
117- echo "| DockerHub | \`alexeiled/nsenter:${version}\` | \`docker pull alexeiled/nsenter:${version}\` |"
126+ if [ "${{ vars.DOCKERHUB_ENABLED }}" = "true" ]; then
127+ echo "| DockerHub | \`alexeiled/nsenter:${version}\` | \`docker pull alexeiled/nsenter:${version}\` |"
128+ fi
118129 echo ""
119130 echo "### Platforms"
120131 echo "- \`linux/amd64\`"
@@ -135,5 +146,6 @@ jobs:
135146 - name : Create GitHub Release
136147 uses : softprops/action-gh-release@v2
137148 with :
149+ tag_name : ${{ needs.build.outputs.version }}
138150 body_path : /tmp/release-notes.md
139151 generate_release_notes : false
0 commit comments