From 4633b5b01cb86f409896356a27b2e7e72735c4e0 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Tue, 5 Sep 2023 16:49:29 -0500 Subject: [PATCH] ci: add starter gh actions --- .github/workflows/build.yml | 33 +++++++++++++++++++ .github/workflows/nightly.yml | 60 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 31 ++++++++++++++++++ nimble.lock | 41 ++++++++++++++++++++++++ 4 files changed, 165 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/nightly.yml create mode 100644 .github/workflows/release.yml create mode 100644 nimble.lock diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..64c49a2 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,33 @@ +name: ⚙️ Build Binaries + +on: + workflow_call: + +jobs: + build-artifact: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - uses: jiro4989/setup-nim-action@v1 + with: + nim-version: ${{ env.NIM_VERSION }} + + + # for cross compilation with ccnz + - uses: goto-bus-stop/setup-zig@v2 + + - name: Generate build artifacts + run: nimble release + + - name: Create artifact bundles + run: nimble bundle + + - uses: actions/upload-artifact@v3 + with: + name: artifacts + path: | + dist/*.tar.gz + dist/*.zip + diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000..04b004d --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,60 @@ +name: 🌙 Nightly Release + +on: + workflow_dispatch: + schedule: + - cron: '0 2 * * *' + +permissions: + contents: write + +jobs: + check-commits: + runs-on: ubuntu-latest + name: Check latest commit + outputs: + quit: ${{ steps.should_run.outputs.quit }} + steps: + - uses: actions/checkout@v3 + + - name: print latest commit + run: echo ${{ github.sha }} + + - id: should_run + name: check latest commit is less than a day + if: ${{ github.event_name == 'schedule' }} + run: | + test -n "$(git rev-list --since="24 hours" HEAD)" \ + && echo "quit=true" >> "$GITHUB_OUTPUT" + + build-artifacts: + needs: check-commits + if: ${{ needs.check-commits.outputs.quit != 'true' }} + uses: ./.github/workflows/build.yml + + create-release: + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ github.token }} + needs: + - build-artifacts + steps: + - uses: actions/checkout@v3 + + - name: Download Build Artifacts + uses: actions/download-artifact@v3 + + - run: ls -R artifacts + + - name: Remove Old Nightly Release + run: | + gh release delete nightly --yes || true + git push origin :nightly || true + + - name: Generate New Nightly Release + run: | + gh release create nightly \ + --title "Nightly Release (Pre-release)" \ + --prerelease \ + ./artifacts/* + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..935ea02 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +name: 🚀 Release + +on: + push: + tags: + - 'v*.*' + +permissions: + contents: write + +jobs: + build-artifacts: + uses: ./.github/workflows/build.yml + + create-release: + env: + GH_TOKEN: ${{ github.token }} + runs-on: ubuntu-latest + needs: + - build-artifacts + steps: + - uses: actions/checkout@v3 + + - name: Download Build Artifacts + uses: actions/download-artifact@v3 + + - run: ls -R artifacts/ + + - name: Generate New Nightly Release + run: | + gh release create ${{ github.ref }} ./artifacts/* diff --git a/nimble.lock b/nimble.lock new file mode 100644 index 0000000..5d5547a --- /dev/null +++ b/nimble.lock @@ -0,0 +1,41 @@ +{ + "version": 2, + "packages": { + "cligen": { + "version": "1.6.14", + "vcsRevision": "bee21f2d0878d4eba4631fd8b67370e4778424de", + "url": "https://github.com/c-blake/cligen.git", + "downloadMethod": "git", + "dependencies": [], + "checksums": { + "sha1": "195164d6a417c5393ee8aac1d1c2dfb0d45574b1" + } + }, + "illwill": { + "version": "0.3.1", + "vcsRevision": "2fe96f5c5a6e216e84554d92090ce3d47460667a", + "url": "https://github.com/johnnovak/illwill", + "downloadMethod": "git", + "dependencies": [], + "checksums": { + "sha1": "ecec6c88a8f0d7e06e4ca6a4405206845357e737" + } + } + }, + "tasks": { + "release": { + "ccnz": { + "version": "2023.1001", + "vcsRevision": "3353d2c6fb957c72fda6ba798ca50d771159e12a", + "url": "https://github.com/daylinmorgan/ccnz", + "downloadMethod": "git", + "dependencies": [ + "cligen" + ], + "checksums": { + "sha1": "405eeb87767929090d8c81ff04a08e639bacb117" + } + } + } + } +}