Repository navigation
fix: bump railpack to v0.36.4 so Vite server apps deploy (#5) #19
Workflow file for this run
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: Publish | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: [main] | |
| types: [opened, synchronize, reopened, closed] | |
| env: | |
| IMAGE: ghcr.io/nitrictech/sugapack | |
| jobs: | |
| test: | |
| if: github.event.action != 'closed' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.26" | |
| - run: go test ./... -v | |
| publish: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: | | |
| github.event_name == 'push' || | |
| (github.event_name == 'pull_request' && | |
| github.event.action != 'closed' && | |
| github.event.pull_request.head.repo.full_name == github.repository) | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: docker/metadata-action@v5 | |
| id: meta | |
| with: | |
| images: ${{ env.IMAGE }} | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
| type=sha,enable=${{ github.event_name == 'push' }} | |
| - uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| cleanup: | |
| if: github.event_name == 'pull_request' && github.event.action == 'closed' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| steps: | |
| - name: Delete PR image version | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_TAG: pr-${{ github.event.pull_request.number }} | |
| run: | | |
| set -euo pipefail | |
| version_id=$(gh api \ | |
| "/orgs/nitrictech/packages/container/sugapack/versions?per_page=100" \ | |
| --jq ".[] | select(.metadata.container.tags[]? == \"$PR_TAG\") | .id" \ | |
| | head -n1) | |
| if [ -z "$version_id" ]; then | |
| echo "No image version found for tag $PR_TAG; nothing to delete." | |
| exit 0 | |
| fi | |
| echo "Deleting package version $version_id (tag: $PR_TAG)" | |
| gh api --method DELETE \ | |
| "/orgs/nitrictech/packages/container/sugapack/versions/$version_id" |