Promote to dev #38
This file contains hidden or 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
| name: Promote to dev | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version tag to promote (leave empty for latest release)' | |
| required: false | |
| type: string | |
| default: '' | |
| concurrency: | |
| group: promote-to-dev | |
| cancel-in-progress: false | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| promote: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Resolve version | |
| id: resolve | |
| env: | |
| VERSION: ${{ inputs.version }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| if [ -z "$VERSION" ]; then | |
| VERSION=$(gh release view --json tagName -q .tagName) | |
| echo "Auto-resolved to latest release: $VERSION" | |
| fi | |
| if ! echo "$VERSION" | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+$'; then | |
| echo "::error::Invalid version format: '$VERSION'. Expected: v0.0.0" | |
| exit 1 | |
| fi | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Retag as dev | |
| env: | |
| VERSION: ${{ steps.resolve.outputs.version }} | |
| run: | | |
| echo "Promoting ghcr.io/posthog/viaduck:${VERSION} → dev" | |
| docker buildx imagetools create \ | |
| --tag "ghcr.io/posthog/viaduck:dev" \ | |
| "ghcr.io/posthog/viaduck:${VERSION}" | |
| echo "Done. ghcr.io/posthog/viaduck:dev now points to ${VERSION}" |