|
| 1 | +--- |
| 2 | +name: release-please |
| 3 | + |
| 4 | +"on": |
| 5 | + push: |
| 6 | + tags: ["v*.*.*"] |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + packages: write |
| 12 | + attestations: write |
| 13 | + id-token: write |
| 14 | + |
| 15 | +jobs: |
| 16 | + release-please: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + outputs: |
| 19 | + release_created: ${{ steps.release.outputs.release_created }} |
| 20 | + tag_name: ${{ steps.release.outputs.tag_name }} |
| 21 | + upload_url: ${{ steps.release.outputs.upload_url }} |
| 22 | + steps: |
| 23 | + - uses: googleapis/release-please-action@v4 |
| 24 | + id: release |
| 25 | + with: |
| 26 | + token: ${{ secrets.PORTER_GITHUB_TOKEN }} |
| 27 | + |
| 28 | + - name: Checkout |
| 29 | + uses: actions/checkout@v5 |
| 30 | + if: ${{ steps.release.outputs.release_created }} |
| 31 | + |
| 32 | + - name: Create package archives |
| 33 | + if: ${{ steps.release.outputs.release_created }} |
| 34 | + run: | |
| 35 | + # Create temporary directory for packaging |
| 36 | + mkdir -p /tmp/package |
| 37 | +
|
| 38 | + # Copy all files except documentation directory |
| 39 | + rsync -av --exclude='documentation/' --exclude='.git/' . /tmp/package/ |
| 40 | +
|
| 41 | + # Create tar.gz archive |
| 42 | + cd /tmp |
| 43 | + tar -czf haproxy-cookbook-${{ steps.release.outputs.tag_name }}.tar.gz package/ |
| 44 | +
|
| 45 | + # Create zip archive |
| 46 | + zip -r haproxy-cookbook-${{ steps.release.outputs.tag_name }}.zip package/ |
| 47 | +
|
| 48 | + # Move archives to workspace |
| 49 | + mv haproxy-cookbook-${{ steps.release.outputs.tag_name }}.tar.gz ${{ github.workspace }}/ |
| 50 | + mv haproxy-cookbook-${{ steps.release.outputs.tag_name }}.zip ${{ github.workspace }}/ |
| 51 | +
|
| 52 | + - name: Generate artifact attestation |
| 53 | + if: ${{ steps.release.outputs.release_created }} |
| 54 | + uses: actions/attest-build-provenance@v1 |
| 55 | + with: |
| 56 | + subject-path: | |
| 57 | + haproxy-cookbook-${{ steps.release.outputs.tag_name }}.tar.gz |
| 58 | + haproxy-cookbook-${{ steps.release.outputs.tag_name }}.zip |
| 59 | +
|
| 60 | + - name: Upload archives to release |
| 61 | + if: ${{ steps.release.outputs.release_created }} |
| 62 | + uses: actions/upload-release-asset@v1 |
| 63 | + env: |
| 64 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 65 | + with: |
| 66 | + upload_url: ${{ steps.release.outputs.upload_url }} |
| 67 | + asset_path: ./haproxy-cookbook-${{ steps.release.outputs.tag_name }}.tar.gz |
| 68 | + asset_name: haproxy-cookbook-${{ steps.release.outputs.tag_name }}.tar.gz |
| 69 | + asset_content_type: application/gzip |
| 70 | + |
| 71 | + - name: Upload zip to release |
| 72 | + if: ${{ steps.release.outputs.release_created }} |
| 73 | + uses: actions/upload-release-asset@v1 |
| 74 | + env: |
| 75 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 76 | + with: |
| 77 | + upload_url: ${{ steps.release.outputs.upload_url }} |
| 78 | + asset_path: ./haproxy-cookbook-${{ steps.release.outputs.tag_name }}.zip |
| 79 | + asset_name: haproxy-cookbook-${{ steps.release.outputs.tag_name }}.zip |
| 80 | + asset_content_type: application/zip |
| 81 | + |
| 82 | + publish-to-supermarket: |
| 83 | + needs: release-please |
| 84 | + if: ${{ needs.release-please.outputs.release_created }} |
| 85 | + runs-on: ubuntu-latest |
| 86 | + container: |
| 87 | + image: chef/chefworkstation:latest |
| 88 | + steps: |
| 89 | + - name: Checkout |
| 90 | + uses: actions/checkout@v5 |
| 91 | + |
| 92 | + - name: Configure Chef credentials |
| 93 | + run: | |
| 94 | + mkdir -p ~/.chef |
| 95 | + echo "${{ secrets.CHEF_SUPERMARKET_KEY }}" > ~/.chef/supermarket.pem |
| 96 | + chmod 600 ~/.chef/supermarket.pem |
| 97 | +
|
| 98 | + - name: Publish to Chef Supermarket |
| 99 | + run: | |
| 100 | + knife supermarket share haproxy \ |
| 101 | + --supermarket-site https://supermarket.chef.io \ |
| 102 | + --key ~/.chef/supermarket.pem \ |
| 103 | + --user-name ${{ secrets.CHEF_SUPERMARKET_USER }} |
0 commit comments