|
1 | | -# inspired by https://github.com/topheman/update-homebrew-tap-playground/blob/master/.github/workflows/cross-compile.yml# inspired by https://github.com/topheman/update-homebrew-tap-playground/blob/master/.github/workflows/cross-compile.yml |
| 1 | +# inspired by https://github.com/topheman/update-homebrew-tap-playground/blob/master/.github/workflows/cross-compile.yml |
2 | 2 | name: Cross-Compile |
3 | 3 |
|
4 | 4 | on: [push] |
|
52 | 52 | with: |
53 | 53 | path: ./compressed |
54 | 54 | key: ${{ matrix.platform.target }}-compressed-binaries-${{ github.sha }} |
55 | | - upload-archives: # will be changed for release-draft |
| 55 | + upload-archives: |
| 56 | + if: false # This step is totally skipped, activate the workflow outside of a tag (for debug purposes) |
56 | 57 | needs: build |
57 | 58 | name: Upload archive for build ${{ matrix.platform.target }} |
58 | 59 | strategy: |
|
75 | 76 | path: ./compressed/ |
76 | 77 | name: ${{ env.BINARY_NAME }}-${{ matrix.platform.target }}.tar.gz |
77 | 78 | retention-days: 10 |
78 | | - |
| 79 | + create-release-draft-if-not-exist: |
| 80 | + if: github.ref_type == 'tag' |
| 81 | + permissions: |
| 82 | + contents: write |
| 83 | + needs: build |
| 84 | + runs-on: ubuntu-latest |
| 85 | + steps: |
| 86 | + - uses: actions/checkout@v4 |
| 87 | + - name: Create release draft |
| 88 | + uses: topheman/create-release-if-not-exist@v1 |
| 89 | + with: |
| 90 | + args: ${{ github.ref_name }} --draft --generate-notes |
| 91 | + upload-artifacts-to-release-draft: |
| 92 | + if: github.ref_type == 'tag' |
| 93 | + permissions: |
| 94 | + contents: write |
| 95 | + needs: create-release-draft-if-not-exist |
| 96 | + env: |
| 97 | + RELEASE_NAME: ${{ github.ref_name }} |
| 98 | + name: Upload artifacts to release draft ${{ matrix.platform.target }} |
| 99 | + strategy: |
| 100 | + matrix: |
| 101 | + platform: |
| 102 | + - target: x86_64-unknown-linux-gnu |
| 103 | + - target: aarch64-unknown-linux-gnu |
| 104 | + - target: x86_64-apple-darwin |
| 105 | + - target: aarch64-apple-darwin |
| 106 | + runs-on: ubuntu-latest |
| 107 | + steps: |
| 108 | + - uses: actions/checkout@v4 |
| 109 | + - name: Restore cached compressed binaries |
| 110 | + uses: actions/cache/restore@v4 |
| 111 | + with: |
| 112 | + path: ./compressed |
| 113 | + key: ${{ matrix.platform.target }}-compressed-binaries-${{ github.sha }} |
| 114 | + - name: Upload artifacts to release draft |
| 115 | + run: | |
| 116 | + gh release upload ${{ env.RELEASE_NAME }} ./compressed/${{ env.BINARY_NAME }}-${{ matrix.platform.target }}.tar.gz |
| 117 | + env: |
| 118 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments