|
| 1 | +on: |
| 2 | + release: |
| 3 | + types: [published] |
| 4 | +name: Build Release Binary (Windows) |
| 5 | +jobs: |
| 6 | + build: |
| 7 | + name: Build Release Binary |
| 8 | + runs-on: windows-2022 |
| 9 | + permissions: |
| 10 | + contents: read |
| 11 | + steps: |
| 12 | + - name: Checkout repository |
| 13 | + uses: actions/checkout@v2 |
| 14 | + - name: Setup msys2 |
| 15 | + uses: msys2/setup-msys2@v2 |
| 16 | + with: |
| 17 | + msystem: MINGW64 |
| 18 | + update: true |
| 19 | + install: >- |
| 20 | + base-devel |
| 21 | + msys2-devel |
| 22 | + mingw-w64-x86_64-toolchain |
| 23 | + mingw-w64-x86_64-openssl |
| 24 | + openssl-devel |
| 25 | + - name: Build binary |
| 26 | + shell: msys2 {0} |
| 27 | + run: make LDFLAGS="-static-libstdc++ -static -lcrypto -lws2_32" |
| 28 | + - name: Upload release artifact |
| 29 | + uses: actions/upload-artifact@v3 |
| 30 | + with: |
| 31 | + name: git-crypt-artifacts |
| 32 | + path: git-crypt.exe |
| 33 | + upload: |
| 34 | + name: Upload Release Binary |
| 35 | + runs-on: ubuntu-latest |
| 36 | + needs: build |
| 37 | + permissions: |
| 38 | + contents: write |
| 39 | + steps: |
| 40 | + - name: Download release artifact |
| 41 | + uses: actions/download-artifact@v3 |
| 42 | + with: |
| 43 | + name: git-crypt-artifacts |
| 44 | + - name: Upload release asset |
| 45 | + uses: actions/github-script@v3 |
| 46 | + with: |
| 47 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 48 | + script: | |
| 49 | + const fs = require("fs").promises; |
| 50 | + const { repo: { owner, repo }, sha } = context; |
| 51 | + await github.repos.uploadReleaseAsset({ |
| 52 | + owner, repo, |
| 53 | + release_id: ${{ github.event.release.id }}, |
| 54 | + name: 'git-crypt-${{ github.event.release.name }}-x86_64.exe', |
| 55 | + data: await fs.readFile('git-crypt.exe'), |
| 56 | + }); |
0 commit comments