From 516220a6d6c89050250b8a9bdc97af6550080ebb Mon Sep 17 00:00:00 2001 From: Paulo Bittencourt Date: Thu, 20 May 2021 13:04:12 -0400 Subject: [PATCH 1/8] Trying out release action --- .github/workflows/test.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b1c90a6..50abd03 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,9 @@ jobs: build: runs-on: ubuntu-latest + env: + GOOS: linux + GOARCH: amd64 steps: - uses: actions/checkout@v2 @@ -20,3 +23,15 @@ jobs: - name: Test run: go test -mod=vendor -v ./... + + - name: Build + run: go build + + - uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "latest" + prerelease: true + title: "Development Build" + files: | + affected From 27809183f8b5a64e038e8468b311f3908fe78212 Mon Sep 17 00:00:00 2001 From: Paulo Bittencourt Date: Thu, 20 May 2021 13:04:26 -0400 Subject: [PATCH 2/8] Use mod=vendor --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 50abd03..de127a4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: run: go test -mod=vendor -v ./... - name: Build - run: go build + run: go build -mod=vendor - uses: "marvinpinto/action-automatic-releases@latest" with: From 36fd9ec6edf232c63bcb98d0f5c77dc0de205102 Mon Sep 17 00:00:00 2001 From: Paulo Bittencourt Date: Thu, 20 May 2021 16:29:27 -0400 Subject: [PATCH 3/8] Try getting branch from ref --- .github/workflows/test.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index de127a4..8c63e66 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Go +name: Test on: push: @@ -27,10 +27,14 @@ jobs: - name: Build run: go build -mod=vendor + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/heads\//} + - uses: "marvinpinto/action-automatic-releases@latest" with: repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest" + automatic_release_tag: "latest_${{ steps.get_version.outputs.VERSION }}" prerelease: true title: "Development Build" files: | From b23a8f83795bb169863f97573fcf159a0a8f6cea Mon Sep 17 00:00:00 2001 From: Paulo Bittencourt Date: Thu, 20 May 2021 16:34:59 -0400 Subject: [PATCH 4/8] Tweak ref parsing --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c63e66..c419590 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,7 +29,7 @@ jobs: - name: Get the version id: get_version - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/heads\//} + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/pull\//} - uses: "marvinpinto/action-automatic-releases@latest" with: From 2f6cd50acf7618499e5f5557ab3cbba72b171f19 Mon Sep 17 00:00:00 2001 From: Paulo Bittencourt Date: Thu, 20 May 2021 16:42:34 -0400 Subject: [PATCH 5/8] Try build output with version and arch --- .github/workflows/test.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c419590..4e1040c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,13 +24,14 @@ jobs: - name: Test run: go test -mod=vendor -v ./... - - name: Build - run: go build -mod=vendor - - name: Get the version id: get_version - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/pull\//} - + run: | + echo ::set-output name=VERSION::v0.0.1-dev + + - name: Build + run: go build -mod=vendor -o affected-${{ steps.get_version.outputs.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }} + - uses: "marvinpinto/action-automatic-releases@latest" with: repo_token: "${{ secrets.GITHUB_TOKEN }}" @@ -38,4 +39,4 @@ jobs: prerelease: true title: "Development Build" files: | - affected + affected-${{ steps.get_version.outputs.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }} From 5702b4d6b9a6bd037256a1be4546ba968148464a Mon Sep 17 00:00:00 2001 From: Paulo Bittencourt Date: Thu, 20 May 2021 16:48:46 -0400 Subject: [PATCH 6/8] Revert changes to test workflow --- .github/workflows/test.yml | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4e1040c..13bff17 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,4 @@ -name: Test - +name: test on: push: branches: [ master ] @@ -10,9 +9,6 @@ jobs: build: runs-on: ubuntu-latest - env: - GOOS: linux - GOARCH: amd64 steps: - uses: actions/checkout@v2 @@ -24,19 +20,5 @@ jobs: - name: Test run: go test -mod=vendor -v ./... - - name: Get the version - id: get_version - run: | - echo ::set-output name=VERSION::v0.0.1-dev - - name: Build - run: go build -mod=vendor -o affected-${{ steps.get_version.outputs.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }} - - - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest_${{ steps.get_version.outputs.VERSION }}" - prerelease: true - title: "Development Build" - files: | - affected-${{ steps.get_version.outputs.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }} + run: go build -mod=vendor From 03a26e94314387780bb3346bf738ce6c83ef3197 Mon Sep 17 00:00:00 2001 From: Paulo Bittencourt Date: Thu, 20 May 2021 16:50:36 -0400 Subject: [PATCH 7/8] Only run test on PR pushes --- .github/workflows/test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 13bff17..1c65f69 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,5 @@ name: test on: - push: - branches: [ master ] pull_request: branches: [ master ] From 00ad7877b362301b7120bf9f206da9b3c9fa8123 Mon Sep 17 00:00:00 2001 From: Paulo Bittencourt Date: Thu, 20 May 2021 16:50:46 -0400 Subject: [PATCH 8/8] Add release action --- .github/workflows/release.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7e840c9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +name: tagged-release + +on: + push: + tags: + - "v*" + +jobs: + build: + runs-on: ubuntu-latest + env: + GOOS: linux + GOARCH: amd64 + steps: + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.15 + + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + + - name: Build + run: go build -mod=vendor -o affected-${{ steps.get_version.outputs.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }} + + - uses: "marvinpinto/action-automatic-releases@v1.2.0" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + files: | + affected-${{ steps.get_version.outputs.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}