From d8a89b014042952f57dc2bb0e45ab76da91dc293 Mon Sep 17 00:00:00 2001 From: Brian Glogower Date: Fri, 2 Feb 2024 13:23:56 -0500 Subject: [PATCH] Create github action to create a release based on tag --- .github/workflows/{go.yml => build-test.yaml} | 5 +- .github/workflows/create-release.yaml | 57 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) rename .github/workflows/{go.yml => build-test.yaml} (91%) create mode 100644 .github/workflows/create-release.yaml diff --git a/.github/workflows/go.yml b/.github/workflows/build-test.yaml similarity index 91% rename from .github/workflows/go.yml rename to .github/workflows/build-test.yaml index 01f60b1..2d8921c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/build-test.yaml @@ -3,7 +3,10 @@ name: Build and Test -on: push +on: + push: + tags-ignore: + - 'v*' jobs: diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml new file mode 100644 index 0000000..5590857 --- /dev/null +++ b/.github/workflows/create-release.yaml @@ -0,0 +1,57 @@ +name: Create Release + +on: + push: + tags: + - 'v-test*' + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + goos: [linux, darwin, windows] + goarch: [arm64, amd64] + + steps: + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.21.6' + + - name: Check out code + uses: actions/checkout@v4 + + - name: Get dependencies + run: go get -v -t -d ./... + + - name: Build + run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -v -o vault-kv-search-${{ matrix.goos }}-${{ matrix.goarch }} + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: vault-kv-search-${{ matrix.goos }}-${{ matrix.goarch }} + path: ./vault-kv-search-${{ matrix.goos }}-${{ matrix.goarch }} + overwrite: true + + release: + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download artifacts + uses: actions/download-artifact@v4 + - name: Display structure of downloaded files + run: ls -R + + - name: Create Release and Upload Assets + uses: softprops/action-gh-release@v1 + with: + draft: true + prerelease: false + files: ./vault-kv-search-*/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file