|
| 1 | +name: Release |
| 2 | +on: |
| 3 | + release: |
| 4 | + types: [published] |
| 5 | +jobs: |
| 6 | + create: |
| 7 | + name: "Create" |
| 8 | + runs-on: macOS |
| 9 | + env: |
| 10 | + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
| 11 | + steps: |
| 12 | + - name: ⬇️ Checkout |
| 13 | + uses: actions/checkout@v5 |
| 14 | + |
| 15 | + - name: ⬇️ Checkout postBuild |
| 16 | + uses: actions/checkout@v5 |
| 17 | + with: |
| 18 | + repository: 4d/${{secrets.POST_BUILD_REPO}} |
| 19 | + token: ${{secrets.PAT_TOKEN}} |
| 20 | + sparse-checkout: | |
| 21 | + ${{ secrets.POST_BUILD_PATH }} |
| 22 | + path: Components/${{ secrets.POST_BUILD_REPO }} |
| 23 | + |
| 24 | + - name: BuildAndPackage |
| 25 | + id: build-package |
| 26 | + uses: 4d/build4d-action@main |
| 27 | + with: |
| 28 | + actions: "release" |
| 29 | + product-line: vcs |
| 30 | + version: vcs |
| 31 | + build: official |
| 32 | + token: ${{ secrets.DLTK }} |
| 33 | + after-build: "./Components/${{ secrets.POST_BUILD_REPO }}/${{ secrets.POST_BUILD_SCRIPT }}" |
| 34 | + sign-certificate: "${{ secrets.SIGN_CERTIFICATE }}" |
| 35 | + env: |
| 36 | + LOGIN_KEYCHAIN_PASSWORD: "${{ secrets.KEYCHAIN }}" |
| 37 | + |
| 38 | + - name: Upload Artifact |
| 39 | + uses: actions/upload-artifact@v4 |
| 40 | + with: |
| 41 | + name: "${{ github.event.repository.name }}.zip" |
| 42 | + path: "build/${{ github.event.repository.name }}.zip" |
| 43 | + retention-days: 1 |
| 44 | + if-no-files-found: error |
| 45 | + |
| 46 | + clear: |
| 47 | + needs: create |
| 48 | + if: failure() |
| 49 | + name: "Clear on failure" |
| 50 | + runs-on: ubuntu-latest |
| 51 | + permissions: |
| 52 | + contents: write # for release deletion |
| 53 | + steps: |
| 54 | + - name: 📄 Checkout repository |
| 55 | + uses: "actions/checkout@v5" |
| 56 | + with: |
| 57 | + fetch-depth: 0 |
| 58 | + - name: Remove release |
| 59 | + run: | |
| 60 | + echo "Build and package step failed. Checking for errors..." |
| 61 | + echo "Removing release" |
| 62 | + gh release delete ${{github.event.release.tag_name}} || echo "Release deletion failed" |
| 63 | + env: |
| 64 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 65 | + |
| 66 | + publish: |
| 67 | + needs: create |
| 68 | + name: "Publish package" |
| 69 | + runs-on: ubuntu-latest |
| 70 | + |
| 71 | + permissions: |
| 72 | + contents: write # for asset upload |
| 73 | + steps: |
| 74 | + - name: 📄 Checkout repository |
| 75 | + uses: "actions/checkout@v5" |
| 76 | + with: |
| 77 | + fetch-depth: 0 |
| 78 | + - name: Download packages |
| 79 | + uses: actions/download-artifact@v4 |
| 80 | + with: |
| 81 | + name: "${{ github.event.repository.name }}.zip" |
| 82 | + path: artifact |
| 83 | + - name: 📦 release package |
| 84 | + run: | |
| 85 | + gh release upload ${{github.event.release.tag_name}} "${{github.workspace}}/artifact/${{ github.event.repository.name }}.zip" |
| 86 | + env: |
| 87 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments