|
| 1 | +name: container |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + packages: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-and-push: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 17 | + with: |
| 18 | + persist-credentials: false |
| 19 | + |
| 20 | + - name: Set up QEMU |
| 21 | + uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0 |
| 22 | + |
| 23 | + - name: Set up Docker Buildx |
| 24 | + uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 |
| 25 | + |
| 26 | + - name: Log in to GitHub Container Registry |
| 27 | + uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 |
| 28 | + with: |
| 29 | + registry: ghcr.io |
| 30 | + username: ${{ github.actor }} |
| 31 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 32 | + |
| 33 | + - name: Docker metadata |
| 34 | + id: meta |
| 35 | + uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0 |
| 36 | + with: |
| 37 | + images: ghcr.io/${{ github.repository }} |
| 38 | + tags: | |
| 39 | + type=semver,pattern={{version}} |
| 40 | + type=semver,pattern={{major}}.{{minor}} |
| 41 | + type=raw,value=latest |
| 42 | +
|
| 43 | + - name: Download release binaries |
| 44 | + env: |
| 45 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + VERSION: ${{ github.event.release.tag_name }} |
| 47 | + run: | |
| 48 | + VERSION_NO_V="${VERSION#v}" |
| 49 | + gh release download "${VERSION}" \ |
| 50 | + --pattern "pipeleek_${VERSION_NO_V}_linux_amd64" \ |
| 51 | + --pattern "pipeleek_${VERSION_NO_V}_linux_arm64" \ |
| 52 | + --repo "${{ github.repository }}" |
| 53 | + mv "pipeleek_${VERSION_NO_V}_linux_amd64" pipeleek_amd64 |
| 54 | + mv "pipeleek_${VERSION_NO_V}_linux_arm64" pipeleek_arm64 |
| 55 | + chmod +x pipeleek_amd64 pipeleek_arm64 |
| 56 | +
|
| 57 | + - name: Build and push container image |
| 58 | + uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 |
| 59 | + with: |
| 60 | + context: . |
| 61 | + platforms: linux/amd64,linux/arm64 |
| 62 | + push: true |
| 63 | + tags: ${{ steps.meta.outputs.tags }} |
| 64 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments