Skip to content

Commit

Permalink
Add GitHub Actions to build & upload release binaries
Browse files Browse the repository at this point in the history
Closes: #227
  • Loading branch information
AGWA committed Apr 21, 2022
1 parent 1c905fa commit 12c4222
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/release-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
on:
release:
types: [published]
name: Build Release Binary (Linux)
jobs:
build:
name: Build Release Binary
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt install libssl-dev
- name: Build binary
run: make
- name: Upload release artifact
uses: actions/upload-artifact@v3
with:
name: git-crypt-artifacts
path: git-crypt
upload:
name: Upload Release Binary
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- name: Download release artifact
uses: actions/download-artifact@v3
with:
name: git-crypt-artifacts
- name: Upload release asset
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require("fs").promises;
const { repo: { owner, repo }, sha } = context;
await github.repos.uploadReleaseAsset({
owner, repo,
release_id: ${{ github.event.release.id }},
name: 'git-crypt-${{ github.event.release.name }}-linux-x86_64',
data: await fs.readFile('git-crypt'),
});
56 changes: 56 additions & 0 deletions .github/workflows/release-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
on:
release:
types: [published]
name: Build Release Binary (Windows)
jobs:
build:
name: Build Release Binary
runs-on: windows-2022
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup msys2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
base-devel
msys2-devel
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-openssl
openssl-devel
- name: Build binary
shell: msys2 {0}
run: make LDFLAGS="-static-libstdc++ -static -lcrypto -lws2_32"
- name: Upload release artifact
uses: actions/upload-artifact@v3
with:
name: git-crypt-artifacts
path: git-crypt.exe
upload:
name: Upload Release Binary
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- name: Download release artifact
uses: actions/download-artifact@v3
with:
name: git-crypt-artifacts
- name: Upload release asset
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require("fs").promises;
const { repo: { owner, repo }, sha } = context;
await github.repos.uploadReleaseAsset({
owner, repo,
release_id: ${{ github.event.release.id }},
name: 'git-crypt-${{ github.event.release.name }}-x86_64.exe',
data: await fs.readFile('git-crypt.exe'),
});

0 comments on commit 12c4222

Please sign in to comment.