diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 036b7e816..21ad5348e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -200,10 +200,13 @@ jobs: environment: Testing runs-on: ubuntu-latest outputs: - environment: ${{ steps.set-env.outputs.environment }} + environment: ${{ steps.environment.outputs.environment }} + version: ${{ steps.version.outputs.version }} steps: + - uses: actions/checkout@v3 + - name: Figure out environment - id: set-env + id: environment run: | if ${{ startsWith(github.ref, 'refs/tags/') }}; then echo "set-output name=environment::Production" @@ -213,6 +216,18 @@ jobs: echo "::set-output name=environment::Testing" fi + - name: Get version string + id: version + run: | + if ${{ startsWith(github.ref, 'refs/tags/') }}; then + echo "set-output name=version::$(git describe --exact-match --tags $(git rev-parse HEAD))" + echo "::set-output name=version::$(git describe --exact-match --tags $(git rev-parse HEAD))" + else + echo "set-output name=version::$(echo unreleased-$(git rev-parse --short HEAD))" + echo "::set-output name=version::$(echo unreleased-$(git rev-parse --short HEAD))" + fi + + Publish-Binary: needs: [Test-Suite, Linting, Docs-Linting, SetEnv] @@ -233,9 +248,6 @@ jobs: with: go-version-file: src/go.mod - - id: version - run: echo "::set-output name=version::$(git describe --exact-match --tags $(git rev-parse HEAD) 2>/dev/null || echo unreleased)-$(git rev-parse --short HEAD)" - - name: Run GoReleaser uses: goreleaser/goreleaser-action@v3 with: @@ -246,7 +258,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} RUDDERSTACK_CORSO_WRITE_KEY: ${{ secrets.RUDDERSTACK_CORSO_WRITE_KEY }} RUDDERSTACK_CORSO_DATA_PLANE_URL: ${{ secrets.RUDDERSTACK_CORSO_DATA_PLANE_URL }} - CORSO_VERSION: ${{ steps.version.outputs.version }} + CORSO_VERSION: ${{ needs.SetEnv.outputs.version }} - name: Upload assets uses: actions/upload-artifact@v3 @@ -272,11 +284,6 @@ jobs: name: cli-docs path: docs/docs/cli - - name: Build docs - run: | - npm ci - CORSO_DOCS_BASEURL="/preview/" npm run build # TODO: update base url once finalized - - name: Configure AWS credentials from Test account if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' uses: aws-actions/configure-aws-credentials@v1 @@ -285,6 +292,13 @@ jobs: role-session-name: integration-testing aws-region: us-east-1 + - name: Build docs + env: + CORSO_VERSION: ${{ needs.SetEnv.outputs.version }} + run: | + npm ci + CORSO_DOCS_BASEURL="/preview/" npm run build # TODO: update base url once finalized + - name: Push docs if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' run: | @@ -347,4 +361,4 @@ jobs: CORSO_BUILD_LDFLAGS=-X 'github.com/alcionai/corso/src/internal/events.RudderStackWriteKey=${{ secrets.RUDDERSTACK_CORSO_WRITE_KEY }}' -X 'github.com/alcionai/corso/src/internal/events.RudderStackDataPlaneURL=${{ secrets.RUDDERSTACK_CORSO_DATA_PLANE_URL }}' -X 'github.com/alcionai/corso/src/cli.version=$(git describe --exact-match --tags $(git rev-parse HEAD) 2>/dev/null || echo unreleased)-$(git rev-parse --short HEAD)' # use the github cache cache-from: type=gha - cache-to: type=gha,mode=max \ No newline at end of file + cache-to: type=gha,mode=max diff --git a/docs/Makefile b/docs/Makefile index c57de2bd7..9ca5120be 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -6,8 +6,8 @@ CORSO_BUILD_MOD := ${CORSO_BUILD_DIR}/mod CORSO_BUILD_BIN := ${CORSO_BUILD_DIR}/bin CORSO_REPO := /go/src/github.com/alcionai/corso CORSO_LOCAL_PATH := $(shell git rev-parse --show-toplevel) -CORSO_VERSION := $(shell git rev-parse --short HEAD) -DOCSC := docker run --rm -it -p 3000:3000 -v ${PWD}:/usr/src/docs --env CORSO_VERSION=${CORSO_VERSION} corso/docs +GIT_SHA := $(shell git rev-parse --short HEAD) +DOCSC := docker run --rm -it -p 3000:3000 -v ${PWD}:/usr/src/docs --env CORSO_VERSION=unreleased-${GIT_SHA} corso/docs CBASE := docker run --rm -it \ -v ${CORSO_LOCAL_PATH}:${CORSO_REPO} -v ${CORSO_BUILD_DIR}:${CORSO_BUILD_DIR} \ --env GOCACHE=${CORSO_BUILD_CACHE} --env GOMODCACHE=${CORSO_BUILD_MOD} --env GOTMPDIR=${CORSO_BUILD_DIR} \