From 2f70c7040ee9df75d4a7783cb19dff67d65136c1 Mon Sep 17 00:00:00 2001 From: "B. Blechschmidt" Date: Mon, 15 Jul 2024 00:22:41 +0200 Subject: [PATCH] Add CI/CD pipeline --- .github/workflows/release.yml | 49 +++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 22 ++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9245ab3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: Deploy Go Binaries + +on: + push: + tags: + - 'v*.*.*' + +permissions: + contents: write + id-token: write + attestations: write + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + check-latest: true + go-version-file: 'go.mod' + + - name: Build + run: make dist + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: bin-${{ github.ref_name }} + path: bin/* + + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v1 + with: + subject-path: bin/* + + - name: Upload Releases + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + files: bin/* + draft: true + prerelease: false \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f5a2883 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,22 @@ +name: Run Tests + +on: push + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + check-latest: true + go-version-file: 'go.mod' + + - name: Run Tests + run: make test \ No newline at end of file