|
1 | 1 | --- |
2 | | -name: 'Release MacOS static libraries' |
| 2 | +name: 'Release static libraries' |
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | tags: |
|
12 | 12 | default: 'rc' |
13 | 13 | required: true |
14 | 14 |
|
| 15 | + |
15 | 16 | permissions: |
16 | 17 | contents: write # needed to write releases |
17 | 18 |
|
18 | 19 | jobs: |
19 | 20 |
|
20 | | - mac-build: |
| 21 | + github_release: |
| 22 | + runs-on: ubuntu-latest |
| 23 | + outputs: |
| 24 | + release_upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 25 | + steps: |
| 26 | + - name: Prepare |
| 27 | + id: prep |
| 28 | + run: | |
| 29 | + VERSION="${{ github.event.inputs.tag }}-${GITHUB_SHA::8}" |
| 30 | + if [[ $GITHUB_REF == refs/tags/* ]]; then |
| 31 | + VERSION=${GITHUB_REF/refs\/tags\//} |
| 32 | + fi |
| 33 | + echo ::set-output name=VERSION::${VERSION} |
| 34 | + - name: Create Release |
| 35 | + id: create_release |
| 36 | + uses: actions/create-release@v1 |
| 37 | + env: |
| 38 | + GITHUB_TOKEN: ${{ github.token }} |
| 39 | + with: |
| 40 | + release_name: ${{ steps.prep.outputs.VERSION }} |
| 41 | + tag_name: ${{ steps.prep.outputs.VERSION }} |
| 42 | + draft: false |
| 43 | + prerelease: true |
| 44 | + |
| 45 | + linux-amd64-release: |
| 46 | + runs-on: ubuntu-latest |
| 47 | + needs: github_release |
| 48 | + steps: |
| 49 | + - name: Checkout |
| 50 | + uses: actions/checkout@v2 |
| 51 | + - name: Build static libraries |
| 52 | + run: | |
| 53 | + TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-linux \ |
| 54 | + BUILD_ROOT_DIR=${GITHUB_WORKSPACE}/libgit2/build/amd \ |
| 55 | + ./hack/static.sh all |
| 56 | + |
| 57 | + mkdir -p ./libgit2-linux/ |
| 58 | + mv ${GITHUB_WORKSPACE}/build/libgit2-linux/include ./libgit2-linux/ |
| 59 | + mv ${GITHUB_WORKSPACE}/build/libgit2-linux/share ./libgit2-linux/ |
| 60 | + mv ${GITHUB_WORKSPACE}/build/libgit2-linux/lib ./libgit2-linux/ |
| 61 | + mv ${GITHUB_WORKSPACE}/build/libgit2-linux/lib64 ./libgit2-linux/ |
| 62 | +
|
| 63 | + tar -zcvf linux-x86_64-libs.tar.gz libgit2-linux |
| 64 | + - name: Upload Release Asset |
| 65 | + id: upload-release-asset |
| 66 | + uses: actions/upload-release-asset@v1 |
| 67 | + env: |
| 68 | + GITHUB_TOKEN: ${{ github.token }} |
| 69 | + with: |
| 70 | + upload_url: ${{ needs.github_release.outputs.release_upload_url }} |
| 71 | + asset_path: ./linux-x86_64-libs.tar.gz |
| 72 | + asset_name: linux-x86_64-libs.tar.gz |
| 73 | + asset_content_type: application/gzip |
| 74 | + |
| 75 | + darwin-release: |
21 | 76 | # This job builds and releases "universal libraries" that are |
22 | 77 | # supported by both darwin-amd64 and darwin-arm64. |
23 | 78 | # |
|
29 | 84 | # of testing, GitHub's macos-10.15 did not seem to. |
30 | 85 | # Cross-compiling to arm64 on that runner consistently failed. |
31 | 86 | runs-on: macos-11 |
| 87 | + needs: github_release |
32 | 88 | steps: |
33 | 89 | - name: Checkout |
34 | 90 | uses: actions/checkout@v2 |
@@ -68,35 +124,16 @@ jobs: |
68 | 124 | ${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/lib/libz.a \ |
69 | 125 | ${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libz.a |
70 | 126 |
|
71 | | - tar -zcvf darwin-libs.tar.gz ./libgit2-darwin |
| 127 | + tar -zcvf darwin-libs.tar.gz libgit2-darwin |
72 | 128 | env: |
73 | 129 | MACOSX_DEPLOYMENT_TARGET: 10.15 |
74 | | - |
75 | | - - name: Prepare |
76 | | - id: prep |
77 | | - run: | |
78 | | - VERSION="${{ github.event.inputs.tag }}-${GITHUB_SHA::8}" |
79 | | - if [[ $GITHUB_REF == refs/tags/* ]]; then |
80 | | - VERSION=${GITHUB_REF/refs\/tags\//} |
81 | | - fi |
82 | | - echo ::set-output name=VERSION::${VERSION} |
83 | | - - name: Create Release |
84 | | - id: create_release |
85 | | - uses: actions/create-release@v1 |
86 | | - env: |
87 | | - GITHUB_TOKEN: ${{ github.token }} |
88 | | - with: |
89 | | - release_name: ${{ steps.prep.outputs.VERSION }} |
90 | | - tag_name: ${{ steps.prep.outputs.VERSION }} |
91 | | - draft: false |
92 | | - prerelease: true |
93 | 130 | - name: Upload Release Asset |
94 | 131 | id: upload-release-asset |
95 | 132 | uses: actions/upload-release-asset@v1 |
96 | 133 | env: |
97 | 134 | GITHUB_TOKEN: ${{ github.token }} |
98 | 135 | with: |
99 | | - upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 136 | + upload_url: ${{ needs.github_release.outputs.release_upload_url }} |
100 | 137 | asset_path: ./darwin-libs.tar.gz |
101 | 138 | asset_name: darwin-libs.tar.gz |
102 | 139 | asset_content_type: application/gzip |
0 commit comments