From 61ba6e24cba3706a18f21c3caae08a42c5159a88 Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Mon, 5 Feb 2024 15:39:19 -0500 Subject: [PATCH 01/21] WIP - ci-build workflow --- .github/workflows/ci-build.yaml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/ci-build.yaml diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml new file mode 100644 index 00000000..94a28a70 --- /dev/null +++ b/.github/workflows/ci-build.yaml @@ -0,0 +1,33 @@ +name: 'CI - Build' + +on: + pull_request: + branches: + - main + +jobs: + golangci: + name: lint + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 + + with: + go-version: '1.21' + cache: false + - name: make-targets + run: make build + - name: smoke-test + run: go test ./... -short -race -cover + - name: Release + uses: softprops/action-gh-release@v1 + # if: startsWith(github.ref, 'refs/tags/') + with: + files: ./target/tructl-darwin-arm64 + body: "This is a test release, and will be removed" + tag_name: "test-release" + repository: opentdf/tructl + generate_release_notes: true + + From f7c896fa2b19c6ed63dd855335ab308ef11de0a3 Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Mon, 5 Feb 2024 15:40:13 -0500 Subject: [PATCH 02/21] WIP - ci-build workflow --- .github/workflows/ci-build.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 94a28a70..9a22aa67 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -4,9 +4,8 @@ on: pull_request: branches: - main - jobs: - golangci: + build-targets: name: lint runs-on: ubuntu-22.04 steps: From 5f5803e6f0bc90187789fc90750a7e21b8256a74 Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Mon, 5 Feb 2024 15:40:57 -0500 Subject: [PATCH 03/21] WIP - ci-build workflow --- .github/workflows/ci-build.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 9a22aa67..4b6be16b 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -1,6 +1,9 @@ name: 'CI - Build' on: + push: + branches: + - feat/implement-ci-build-workflow pull_request: branches: - main From 011082e1311a14bc8264ab28a24a8b045acb59a3 Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Mon, 5 Feb 2024 15:43:08 -0500 Subject: [PATCH 04/21] WIP - ci-build workflow --- .github/workflows/ci-build.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 4b6be16b..a11490da 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -12,12 +12,13 @@ jobs: name: lint runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 - + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: go-version: '1.21' cache: false + - name: set-env-vars + run: go env -w "GOPRIVATE=github.com/opentdf/*" - name: make-targets run: make build - name: smoke-test From 23c49ff41b70413597cf07c5235b5cc9e5072342 Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Mon, 5 Feb 2024 15:44:32 -0500 Subject: [PATCH 05/21] WIP - ci-build workflow --- .github/workflows/ci-build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index a11490da..ca5e7ee8 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -11,14 +11,14 @@ jobs: build-targets: name: lint runs-on: ubuntu-22.04 + env: + GOPRIVATE: "github.com/opentdf/*" steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: go-version: '1.21' cache: false - - name: set-env-vars - run: go env -w "GOPRIVATE=github.com/opentdf/*" - name: make-targets run: make build - name: smoke-test From 5dae516bd1a8dfb29b616b11c60ca455a02f9efa Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Mon, 5 Feb 2024 15:54:52 -0500 Subject: [PATCH 06/21] WIP - ci-build workflow --- .github/workflows/ci-build.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index ca5e7ee8..1958f118 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -9,7 +9,7 @@ on: - main jobs: build-targets: - name: lint + name: build-targets runs-on: ubuntu-22.04 env: GOPRIVATE: "github.com/opentdf/*" @@ -19,6 +19,8 @@ jobs: with: go-version: '1.21' cache: false + - name: print-vars + run: echo "${GOPRIVATE}" - name: make-targets run: make build - name: smoke-test From 0f7729b62163a40edf9c1b141b62693a55e65b3b Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Tue, 6 Feb 2024 10:38:00 -0500 Subject: [PATCH 07/21] WIP - ci-build workflow --- .github/workflows/ci-build.yaml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 1958f118..c60935fd 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -12,15 +12,23 @@ jobs: name: build-targets runs-on: ubuntu-22.04 env: - GOPRIVATE: "github.com/opentdf/*" + GOPRIVATE: github.com/opentdf/opentdf-v2-poc/* steps: + # special app the virtru eng team created, to grab a token for accessing other org repos, in a secure way + - name: Generate a token + id: generate_token + uses: actions/create-github-app-token@v1.5.0 + with: + app-id: '416599' + private-key: '${{ secrets.GH_APP_PRIVATE_KEY }}' + owner: ${{ github.repository_owner }} + repositories: 'opentdf-v2-poc' + - run: git config --global url.https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com/.insteadOf https://github.com/ - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: go-version: '1.21' cache: false - - name: print-vars - run: echo "${GOPRIVATE}" - name: make-targets run: make build - name: smoke-test From 342d6e7fd3964d8c5b0034b5e243e01f5ed798f8 Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Tue, 6 Feb 2024 10:59:57 -0500 Subject: [PATCH 08/21] Add version increment on release --- .github/workflows/ci-build.yaml | 31 +++++++++++++++++++++++++++---- Makefile | 23 ++++++++++++++--------- 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index c60935fd..80f0a6f7 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -13,7 +13,18 @@ jobs: runs-on: ubuntu-22.04 env: GOPRIVATE: github.com/opentdf/opentdf-v2-poc/* + BIN_NAME: tructl steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + - name: Get next version + uses: reecetech/version-increment@2023.9.3 + id: version + with: + scheme: semver + increment: patch + - name: print-version + run: echo ${{ steps.version.outputs.version }} # special app the virtru eng team created, to grab a token for accessing other org repos, in a secure way - name: Generate a token id: generate_token @@ -24,22 +35,34 @@ jobs: owner: ${{ github.repository_owner }} repositories: 'opentdf-v2-poc' - run: git config --global url.https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com/.insteadOf https://github.com/ - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + with: go-version: '1.21' cache: false - name: make-targets + env: + SEM_VER: ${{ steps.version.outputs.version }} run: make build - name: smoke-test run: go test ./... -short -race -cover - name: Release + env: + SEM_VER: ${{ steps.version.outputs.version }} uses: softprops/action-gh-release@v1 # if: startsWith(github.ref, 'refs/tags/') with: - files: ./target/tructl-darwin-arm64 + files: | + ./target/$(BIN_NAME)-${SEM_VER}-darwin-amd64 + ./target/$(BIN_NAME)-${SEM_VER}-darwin-arm64 + ./target/$(BIN_NAME)-${SEM_VER}-linux-amd64 + ./target/$(BIN_NAME)-${SEM_VER}-linux-arm + ./target/$(BIN_NAME)-${SEM_VER}-linux-arm64 + ./target/$(BIN_NAME)-${SEM_VER}-windows-amd64.exe + ./target/$(BIN_NAME)-${SEM_VER}-windows-arm.exe + ./target/$(BIN_NAME)-${SEM_VER}-windows-arm64.exe + body: "This is a test release, and will be removed" - tag_name: "test-release" + tag_name: ${{ steps.version.outputs.version }} repository: opentdf/tructl generate_release_notes: true diff --git a/Makefile b/Makefile index 3f1feab8..a40e52cf 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,8 @@ # We're going to be using this Makefile as a sort of task runner, for all sorts of operations in this project +# first we'll grab the current version from our ENV VAR (added by our CI) - see here: https://github.com/marketplace/actions/version-increment +CURR_VERSION := ${SEM_VER} + # Default target executed when no arguments are given to make. # NOTE: .PHONY is used to indicate that the target is not a file (e.g. there is no file called 'build-darwin-amd64', instead the .PHONY directive tells make that the proceeding target is a command to be executed, not a file to be generated) .PHONY: all @@ -7,8 +10,10 @@ all: run .DEFAULT_GOAL := run + + # Binary name: Change this to your actual binary name -BINARY_NAME=tructl +BINARY_NAME=${BIN_NAME} # Output directory for compiled binaries @@ -20,28 +25,28 @@ build: clean build-darwin-amd64 build-darwin-arm64 build-linux-amd64 build-linux # Build commands for each platform build-darwin-amd64: - GOOS=darwin GOARCH=amd64 go build -o $(OUT_DIR)/$(BINARY_NAME)-darwin-amd64 . + GOOS=darwin GOARCH=amd64 go build -o $(OUT_DIR)/$(BINARY_NAME)-${CURR_VERSION}-darwin-amd64 . build-darwin-arm64: - GOOS=darwin GOARCH=arm64 go build -o $(OUT_DIR)/$(BINARY_NAME)-darwin-arm64 . + GOOS=darwin GOARCH=arm64 go build -o $(OUT_DIR)/$(BINARY_NAME)-${CURR_VERSION}-darwin-arm64 . build-linux-amd64: - GOOS=linux GOARCH=amd64 go build -o $(OUT_DIR)/$(BINARY_NAME)-linux-amd64 . + GOOS=linux GOARCH=amd64 go build -o $(OUT_DIR)/$(BINARY_NAME)-${CURR_VERSION}-linux-amd64 . build-linux-arm: - GOOS=linux GOARCH=arm go build -o $(OUT_DIR)/$(BINARY_NAME)-linux-arm . + GOOS=linux GOARCH=arm go build -o $(OUT_DIR)/$(BINARY_NAME)-${CURR_VERSION}-linux-arm . build-linux-arm64: - GOOS=linux GOARCH=arm64 go build -o $(OUT_DIR)/$(BINARY_NAME)-linux-arm64 . + GOOS=linux GOARCH=arm64 go build -o $(OUT_DIR)/$(BINARY_NAME)-${CURR_VERSION}-linux-arm64 . build-windows-amd64: - GOOS=windows GOARCH=amd64 go build -o $(OUT_DIR)/$(BINARY_NAME)-windows-amd64.exe . + GOOS=windows GOARCH=amd64 go build -o $(OUT_DIR)/$(BINARY_NAME)-${CURR_VERSION}-windows-amd64.exe . build-windows-arm: - GOOS=windows GOARCH=arm go build -o $(OUT_DIR)/$(BINARY_NAME)-windows-arm.exe . + GOOS=windows GOARCH=arm go build -o $(OUT_DIR)/$(BINARY_NAME)-${CURR_VERSION}-windows-arm.exe . build-windows-arm64: - GOOS=windows GOARCH=arm64 go build -o $(OUT_DIR)/$(BINARY_NAME)-windows-arm64.exe . + GOOS=windows GOARCH=arm64 go build -o $(OUT_DIR)/$(BINARY_NAME)-${CURR_VERSION}-windows-arm64.exe . # Target for running the project (adjust as necessary for your project) .PHONY: run From ea5625572ab522ee598ffc09d4768db58ec47d0f Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Tue, 6 Feb 2024 11:01:12 -0500 Subject: [PATCH 09/21] fix invalid with statement --- .github/workflows/ci-build.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 80f0a6f7..ff357549 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -17,6 +17,9 @@ jobs: steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 + with: + go-version: '1.21' + cache: false - name: Get next version uses: reecetech/version-increment@2023.9.3 id: version @@ -35,10 +38,6 @@ jobs: owner: ${{ github.repository_owner }} repositories: 'opentdf-v2-poc' - run: git config --global url.https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com/.insteadOf https://github.com/ - - with: - go-version: '1.21' - cache: false - name: make-targets env: SEM_VER: ${{ steps.version.outputs.version }} From f53f3b0f5b5fafe8742ce05ff508f2df8042a53b Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Tue, 6 Feb 2024 11:08:13 -0500 Subject: [PATCH 10/21] adjust yaml env var syntax --- .github/workflows/ci-build.yaml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index ff357549..a60829bd 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -47,18 +47,19 @@ jobs: - name: Release env: SEM_VER: ${{ steps.version.outputs.version }} + BIN_NAME: tructl uses: softprops/action-gh-release@v1 # if: startsWith(github.ref, 'refs/tags/') with: files: | - ./target/$(BIN_NAME)-${SEM_VER}-darwin-amd64 - ./target/$(BIN_NAME)-${SEM_VER}-darwin-arm64 - ./target/$(BIN_NAME)-${SEM_VER}-linux-amd64 - ./target/$(BIN_NAME)-${SEM_VER}-linux-arm - ./target/$(BIN_NAME)-${SEM_VER}-linux-arm64 - ./target/$(BIN_NAME)-${SEM_VER}-windows-amd64.exe - ./target/$(BIN_NAME)-${SEM_VER}-windows-arm.exe - ./target/$(BIN_NAME)-${SEM_VER}-windows-arm64.exe + ./target/${{BIN_NAME}}-${{SEM_VER}}-darwin-amd64 + ./target/${{BIN_NAME}}-${{SEM_VER}}-darwin-arm64 + ./target/${{BIN_NAME}}-${{SEM_VER}}-linux-amd64 + ./target/${{BIN_NAME}}-${{SEM_VER}}-linux-arm + ./target/${{BIN_NAME}}-${{SEM_VER}}-linux-arm64 + ./target/${{BIN_NAME}}-${{SEM_VER}}-windows-amd64.exe + ./target/${{BIN_NAME}}-${{SEM_VER}}-windows-arm.exe + ./target/${{BIN_NAME}}-${{SEM_VER}}-windows-arm64.exe body: "This is a test release, and will be removed" tag_name: ${{ steps.version.outputs.version }} From 21f3221adeabc53b1820fa260cd1bac7131ab3dc Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Tue, 6 Feb 2024 11:10:50 -0500 Subject: [PATCH 11/21] adjust yaml env var syntax --- .github/workflows/ci-build.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index a60829bd..578ba993 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -52,14 +52,14 @@ jobs: # if: startsWith(github.ref, 'refs/tags/') with: files: | - ./target/${{BIN_NAME}}-${{SEM_VER}}-darwin-amd64 - ./target/${{BIN_NAME}}-${{SEM_VER}}-darwin-arm64 - ./target/${{BIN_NAME}}-${{SEM_VER}}-linux-amd64 - ./target/${{BIN_NAME}}-${{SEM_VER}}-linux-arm - ./target/${{BIN_NAME}}-${{SEM_VER}}-linux-arm64 - ./target/${{BIN_NAME}}-${{SEM_VER}}-windows-amd64.exe - ./target/${{BIN_NAME}}-${{SEM_VER}}-windows-arm.exe - ./target/${{BIN_NAME}}-${{SEM_VER}}-windows-arm64.exe + ./target/$BIN_NAME-$SEM_VER-darwin-amd64 + ./target/$BIN_NAME-$SEM_VER-darwin-arm64 + ./target/$BIN_NAME-$SEM_VER-linux-amd64 + ./target/$BIN_NAME-$SEM_VER-linux-arm + ./target/$BIN_NAME-$SEM_VER-linux-arm64 + ./target/$BIN_NAME-$SEM_VER-windows-amd64.exe + ./target/$BIN_NAME-$SEM_VER-windows-arm.exe + ./target/$BIN_NAME-$SEM_VER-windows-arm64.exe body: "This is a test release, and will be removed" tag_name: ${{ steps.version.outputs.version }} From 04447e22cf9f717f19871048237a6167730c446b Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Tue, 6 Feb 2024 11:16:21 -0500 Subject: [PATCH 12/21] adjust yaml env var syntax --- .github/workflows/ci-build.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 578ba993..2ad612cd 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -26,8 +26,9 @@ jobs: with: scheme: semver increment: patch + pep440: false - name: print-version - run: echo ${{ steps.version.outputs.version }} + run: echo Incrementing Version ${{ steps.version.outputs.current-version }} -> ${{ steps.version.outputs.version }} # special app the virtru eng team created, to grab a token for accessing other org repos, in a secure way - name: Generate a token id: generate_token @@ -40,16 +41,15 @@ jobs: - run: git config --global url.https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com/.insteadOf https://github.com/ - name: make-targets env: - SEM_VER: ${{ steps.version.outputs.version }} + SEM_VER: ${{ steps.version.outputs.major-version }}.${{ steps.version.outputs.minor-version }}.${{ steps.version.outputs.patch-version }} run: make build - name: smoke-test run: go test ./... -short -race -cover - name: Release - env: - SEM_VER: ${{ steps.version.outputs.version }} - BIN_NAME: tructl + # env: + # SEM_VER: ${{ steps.version.outputs.major-version }}.${{ steps.version.outputs.minor-version }}.${{ steps.version.outputs.patch-version }} + # BIN_NAME: tructl uses: softprops/action-gh-release@v1 - # if: startsWith(github.ref, 'refs/tags/') with: files: | ./target/$BIN_NAME-$SEM_VER-darwin-amd64 From 7225b47cd33b523a6b8963fae688d4ab7abf215f Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Tue, 6 Feb 2024 11:19:07 -0500 Subject: [PATCH 13/21] ensure incremented version is tagged back to the repo --- .github/workflows/ci-build.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 2ad612cd..18ad495f 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -24,11 +24,12 @@ jobs: uses: reecetech/version-increment@2023.9.3 id: version with: + release_branch: feat/implement-ci-build-workflow scheme: semver increment: patch pep440: false - name: print-version - run: echo Incrementing Version ${{ steps.version.outputs.current-version }} -> ${{ steps.version.outputs.version }} + run: echo Incrementing Version ${{ steps.version.outputs.current-version }} -> ${{ steps.version.outputs.major-version }}.${{ steps.version.outputs.minor-version }}.${{ steps.version.outputs.patch-version }} # special app the virtru eng team created, to grab a token for accessing other org repos, in a secure way - name: Generate a token id: generate_token From de524d163d1c626730fa5e15234ff7ba0b0a20b9 Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Tue, 6 Feb 2024 11:20:01 -0500 Subject: [PATCH 14/21] ensure incremented version is tagged back to the repo x2 --- .github/workflows/ci-build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 18ad495f..e62e1125 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -29,7 +29,7 @@ jobs: increment: patch pep440: false - name: print-version - run: echo Incrementing Version ${{ steps.version.outputs.current-version }} -> ${{ steps.version.outputs.major-version }}.${{ steps.version.outputs.minor-version }}.${{ steps.version.outputs.patch-version }} + run: echo Incrementing Version ${{ steps.version.outputs.current-version }} -> ${{ steps.version.outputs.version }} # special app the virtru eng team created, to grab a token for accessing other org repos, in a secure way - name: Generate a token id: generate_token From 2dbf6100b2009fb57f2eb15d53f9d156f6babb23 Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Tue, 6 Feb 2024 12:49:16 -0500 Subject: [PATCH 15/21] fix env var reference syntax for released asset filenames --- .github/workflows/ci-build.yaml | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index e62e1125..34e6d2e2 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -4,8 +4,6 @@ on: push: branches: - feat/implement-ci-build-workflow - pull_request: - branches: - main jobs: build-targets: @@ -42,25 +40,22 @@ jobs: - run: git config --global url.https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com/.insteadOf https://github.com/ - name: make-targets env: - SEM_VER: ${{ steps.version.outputs.major-version }}.${{ steps.version.outputs.minor-version }}.${{ steps.version.outputs.patch-version }} + SEM_VER: ${{ steps.version.outputs.version }} run: make build - name: smoke-test run: go test ./... -short -race -cover - name: Release - # env: - # SEM_VER: ${{ steps.version.outputs.major-version }}.${{ steps.version.outputs.minor-version }}.${{ steps.version.outputs.patch-version }} - # BIN_NAME: tructl uses: softprops/action-gh-release@v1 with: files: | - ./target/$BIN_NAME-$SEM_VER-darwin-amd64 - ./target/$BIN_NAME-$SEM_VER-darwin-arm64 - ./target/$BIN_NAME-$SEM_VER-linux-amd64 - ./target/$BIN_NAME-$SEM_VER-linux-arm - ./target/$BIN_NAME-$SEM_VER-linux-arm64 - ./target/$BIN_NAME-$SEM_VER-windows-amd64.exe - ./target/$BIN_NAME-$SEM_VER-windows-arm.exe - ./target/$BIN_NAME-$SEM_VER-windows-arm64.exe + "./target/$BIN_NAME-$SEM_VER-darwin-amd64" + "./target/$BIN_NAME-$SEM_VER-darwin-arm64" + "./target/$BIN_NAME-$SEM_VER-linux-amd64" + "./target/$BIN_NAME-$SEM_VER-linux-arm" + "./target/$BIN_NAME-$SEM_VER-linux-arm64" + "./target/$BIN_NAME-$SEM_VER-windows-amd64.exe" + "./target/$BIN_NAME-$SEM_VER-windows-arm.exe" + "./target/$BIN_NAME-$SEM_VER-windows-arm64.exe" body: "This is a test release, and will be removed" tag_name: ${{ steps.version.outputs.version }} From 2609491eb22fa5853aa80a2369f1af1a2e3e926b Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Tue, 6 Feb 2024 12:59:48 -0500 Subject: [PATCH 16/21] debug env vars --- .github/workflows/ci-build.yaml | 42 ++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 34e6d2e2..fc181fb9 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -41,25 +41,35 @@ jobs: - name: make-targets env: SEM_VER: ${{ steps.version.outputs.version }} + TARGET_DARWIN_AMD64: ./target/${BIN_NAME}-${SEM_VER}-darwin-amd64 + TARGET_DARWIN_ARM64: ./target/${BIN_NAME}-${SEM_VER}-darwin-arm64 + TARGET_LINUX_AMD64: ./target/${BIN_NAME}-${SEM_VER}-linux-amd64 + TARGET_LINUX_ARM: ./target/${BIN_NAME}-${SEM_VER}-linux-arm + TARGET_LINUX_ARM64: ./target/${BIN_NAME}-${SEM_VER}-linux-arm64 + TARGET_WINDOWS_AMD64: ./target/${BIN_NAME}-${SEM_VER}-windows-amd64.exe + TARGET_WINDOWS_ARM: ./target/${BIN_NAME}-${SEM_VER}-windows-arm.exe + TARGET_WINDOWS_ARM64: ./target/${BIN_NAME}-${SEM_VER}-windows-arm64.exe run: make build + - name: debug-env-vars + run: echo ${TARGET_DARWIN_AMD64} ${TARGET_DARWIN_ARM64} ${TARGET_LINUX_AMD64} ${TARGET_LINUX_ARM} ${TARGET_LINUX_ARM64} ${TARGET_WINDOWS_AMD64} ${TARGET_WINDOWS_ARM} ${TARGET_WINDOWS_ARM64} - name: smoke-test run: go test ./... -short -race -cover - - name: Release - uses: softprops/action-gh-release@v1 - with: - files: | - "./target/$BIN_NAME-$SEM_VER-darwin-amd64" - "./target/$BIN_NAME-$SEM_VER-darwin-arm64" - "./target/$BIN_NAME-$SEM_VER-linux-amd64" - "./target/$BIN_NAME-$SEM_VER-linux-arm" - "./target/$BIN_NAME-$SEM_VER-linux-arm64" - "./target/$BIN_NAME-$SEM_VER-windows-amd64.exe" - "./target/$BIN_NAME-$SEM_VER-windows-arm.exe" - "./target/$BIN_NAME-$SEM_VER-windows-arm64.exe" + # - name: Release + # uses: softprops/action-gh-release@v1 + # with: + # files: | + # ./target/$BIN_NAME-$SEM_VER-darwin-amd64 + # ./target/$BIN_NAME-$SEM_VER-darwin-arm64 + # ./target/$BIN_NAME-$SEM_VER-linux-amd64 + # ./target/$BIN_NAME-$SEM_VER-linux-arm + # ./target/$BIN_NAME-$SEM_VER-linux-arm64 + # ./target/$BIN_NAME-$SEM_VER-windows-amd64.exe + # ./target/$BIN_NAME-$SEM_VER-windows-arm.exe + # ./target/$BIN_NAME-$SEM_VER-windows-arm64.exe - body: "This is a test release, and will be removed" - tag_name: ${{ steps.version.outputs.version }} - repository: opentdf/tructl - generate_release_notes: true + # body: "This is a test release, and will be removed" + # tag_name: ${{ steps.version.outputs.version }} + # repository: opentdf/tructl + # generate_release_notes: true From daf991b970bc075c9b5f6251f45410a8df9032b3 Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Tue, 6 Feb 2024 13:03:08 -0500 Subject: [PATCH 17/21] try wilde card approach to adding asset files to release step --- .github/workflows/ci-build.yaml | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index fc181fb9..16110b90 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -41,35 +41,18 @@ jobs: - name: make-targets env: SEM_VER: ${{ steps.version.outputs.version }} - TARGET_DARWIN_AMD64: ./target/${BIN_NAME}-${SEM_VER}-darwin-amd64 - TARGET_DARWIN_ARM64: ./target/${BIN_NAME}-${SEM_VER}-darwin-arm64 - TARGET_LINUX_AMD64: ./target/${BIN_NAME}-${SEM_VER}-linux-amd64 - TARGET_LINUX_ARM: ./target/${BIN_NAME}-${SEM_VER}-linux-arm - TARGET_LINUX_ARM64: ./target/${BIN_NAME}-${SEM_VER}-linux-arm64 - TARGET_WINDOWS_AMD64: ./target/${BIN_NAME}-${SEM_VER}-windows-amd64.exe - TARGET_WINDOWS_ARM: ./target/${BIN_NAME}-${SEM_VER}-windows-arm.exe - TARGET_WINDOWS_ARM64: ./target/${BIN_NAME}-${SEM_VER}-windows-arm64.exe run: make build - name: debug-env-vars run: echo ${TARGET_DARWIN_AMD64} ${TARGET_DARWIN_ARM64} ${TARGET_LINUX_AMD64} ${TARGET_LINUX_ARM} ${TARGET_LINUX_ARM64} ${TARGET_WINDOWS_AMD64} ${TARGET_WINDOWS_ARM} ${TARGET_WINDOWS_ARM64} - name: smoke-test run: go test ./... -short -race -cover - # - name: Release - # uses: softprops/action-gh-release@v1 - # with: - # files: | - # ./target/$BIN_NAME-$SEM_VER-darwin-amd64 - # ./target/$BIN_NAME-$SEM_VER-darwin-arm64 - # ./target/$BIN_NAME-$SEM_VER-linux-amd64 - # ./target/$BIN_NAME-$SEM_VER-linux-arm - # ./target/$BIN_NAME-$SEM_VER-linux-arm64 - # ./target/$BIN_NAME-$SEM_VER-windows-amd64.exe - # ./target/$BIN_NAME-$SEM_VER-windows-arm.exe - # ./target/$BIN_NAME-$SEM_VER-windows-arm64.exe - - # body: "This is a test release, and will be removed" - # tag_name: ${{ steps.version.outputs.version }} - # repository: opentdf/tructl - # generate_release_notes: true + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: './target/**/*' + body: "This is a test release, and will be removed" + tag_name: ${{ steps.version.outputs.version }} + repository: opentdf/tructl + generate_release_notes: true From dd9f8c2b0503cbf91d5aa4e8ae498f37878bc761 Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Tue, 6 Feb 2024 13:12:13 -0500 Subject: [PATCH 18/21] run final test flow --- .github/workflows/ci-build.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 16110b90..2bbefb15 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -1,5 +1,4 @@ name: 'CI - Build' - on: push: branches: @@ -42,8 +41,6 @@ jobs: env: SEM_VER: ${{ steps.version.outputs.version }} run: make build - - name: debug-env-vars - run: echo ${TARGET_DARWIN_AMD64} ${TARGET_DARWIN_ARM64} ${TARGET_LINUX_AMD64} ${TARGET_LINUX_ARM} ${TARGET_LINUX_ARM64} ${TARGET_WINDOWS_AMD64} ${TARGET_WINDOWS_ARM} ${TARGET_WINDOWS_ARM64} - name: smoke-test run: go test ./... -short -race -cover - name: Release From 1a7d62e1ec6cf1a31d4644f9b6480a7837ec9ed2 Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Tue, 6 Feb 2024 13:19:41 -0500 Subject: [PATCH 19/21] remove the 'on_push' trigger for the development branch of this feature --- .github/workflows/ci-build.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 2bbefb15..3b2850c3 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -2,7 +2,6 @@ name: 'CI - Build' on: push: branches: - - feat/implement-ci-build-workflow - main jobs: build-targets: From 54d58ca00df51c8d855ad8e05c6b9accd4db76c2 Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Tue, 6 Feb 2024 14:09:45 -0500 Subject: [PATCH 20/21] resolve PR comments --- .github/workflows/ci-build.yaml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 3b2850c3..db29e75d 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -1,8 +1,5 @@ name: 'CI - Build' -on: - push: - branches: - - main +on: workflow_dispatch jobs: build-targets: name: build-targets @@ -12,15 +9,15 @@ jobs: BIN_NAME: tructl steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version-file: './go.mod' cache: false - name: Get next version uses: reecetech/version-increment@2023.9.3 id: version with: - release_branch: feat/implement-ci-build-workflow + release_branch: main scheme: semver increment: patch pep440: false From 4a83a4b59ebbd663556c6c6b853febfbc8bfbceb Mon Sep 17 00:00:00 2001 From: Avery Pfeiffer Date: Tue, 6 Feb 2024 14:29:34 -0500 Subject: [PATCH 21/21] move to 'manual' runs of the build and release action, force user to input version bump type at runtime --- .github/workflows/ci-build.yaml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index db29e75d..5c42c148 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -1,5 +1,16 @@ name: 'CI - Build' -on: workflow_dispatch +on: + workflow_dispatch: + inputs: + versionBumpType: + description: 'Version Bump Type' + required: true + default: 'patch' + type: choice + options: + - patch + - minor + - major jobs: build-targets: name: build-targets @@ -19,7 +30,7 @@ jobs: with: release_branch: main scheme: semver - increment: patch + increment: ${{ github.event.inputs.versionBumpType }} pep440: false - name: print-version run: echo Incrementing Version ${{ steps.version.outputs.current-version }} -> ${{ steps.version.outputs.version }}