Add CORSO_VERSION to docs env when building (#1215)
## Description Adds the new CORSO_VERSION env needed to build docs in CI.  ## Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature - [ ] 🐛 Bugfix - [x] 🗺️ Documentation - [ ] 🤖 Test - [x] 💻 CI/Deployment - [ ] 🐹 Trivial/Minor ## Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * fixes https://github.com/alcionai/corso/issues/29 * https://github.com/alcionai/corso/pull/1205 ## Test Plan <!-- How will this be tested prior to merging.--> - [x] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
f0e28ea4c7
commit
7221d616ac
38
.github/workflows/ci.yml
vendored
38
.github/workflows/ci.yml
vendored
@ -200,10 +200,13 @@ jobs:
|
|||||||
environment: Testing
|
environment: Testing
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
environment: ${{ steps.set-env.outputs.environment }}
|
environment: ${{ steps.environment.outputs.environment }}
|
||||||
|
version: ${{ steps.version.outputs.version }}
|
||||||
steps:
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Figure out environment
|
- name: Figure out environment
|
||||||
id: set-env
|
id: environment
|
||||||
run: |
|
run: |
|
||||||
if ${{ startsWith(github.ref, 'refs/tags/') }}; then
|
if ${{ startsWith(github.ref, 'refs/tags/') }}; then
|
||||||
echo "set-output name=environment::Production"
|
echo "set-output name=environment::Production"
|
||||||
@ -213,6 +216,18 @@ jobs:
|
|||||||
echo "::set-output name=environment::Testing"
|
echo "::set-output name=environment::Testing"
|
||||||
fi
|
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:
|
Publish-Binary:
|
||||||
needs: [Test-Suite, Linting, Docs-Linting, SetEnv]
|
needs: [Test-Suite, Linting, Docs-Linting, SetEnv]
|
||||||
@ -233,9 +248,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version-file: src/go.mod
|
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
|
- name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v3
|
uses: goreleaser/goreleaser-action@v3
|
||||||
with:
|
with:
|
||||||
@ -246,7 +258,7 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
RUDDERSTACK_CORSO_WRITE_KEY: ${{ secrets.RUDDERSTACK_CORSO_WRITE_KEY }}
|
RUDDERSTACK_CORSO_WRITE_KEY: ${{ secrets.RUDDERSTACK_CORSO_WRITE_KEY }}
|
||||||
RUDDERSTACK_CORSO_DATA_PLANE_URL: ${{ secrets.RUDDERSTACK_CORSO_DATA_PLANE_URL }}
|
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
|
- name: Upload assets
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
@ -272,11 +284,6 @@ jobs:
|
|||||||
name: cli-docs
|
name: cli-docs
|
||||||
path: docs/docs/cli
|
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
|
- name: Configure AWS credentials from Test account
|
||||||
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
|
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
|
||||||
uses: aws-actions/configure-aws-credentials@v1
|
uses: aws-actions/configure-aws-credentials@v1
|
||||||
@ -285,6 +292,13 @@ jobs:
|
|||||||
role-session-name: integration-testing
|
role-session-name: integration-testing
|
||||||
aws-region: us-east-1
|
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
|
- name: Push docs
|
||||||
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
|
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
|
||||||
run: |
|
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)'
|
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
|
# use the github cache
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|||||||
@ -6,8 +6,8 @@ CORSO_BUILD_MOD := ${CORSO_BUILD_DIR}/mod
|
|||||||
CORSO_BUILD_BIN := ${CORSO_BUILD_DIR}/bin
|
CORSO_BUILD_BIN := ${CORSO_BUILD_DIR}/bin
|
||||||
CORSO_REPO := /go/src/github.com/alcionai/corso
|
CORSO_REPO := /go/src/github.com/alcionai/corso
|
||||||
CORSO_LOCAL_PATH := $(shell git rev-parse --show-toplevel)
|
CORSO_LOCAL_PATH := $(shell git rev-parse --show-toplevel)
|
||||||
CORSO_VERSION := $(shell git rev-parse --short HEAD)
|
GIT_SHA := $(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
|
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 \
|
CBASE := docker run --rm -it \
|
||||||
-v ${CORSO_LOCAL_PATH}:${CORSO_REPO} -v ${CORSO_BUILD_DIR}:${CORSO_BUILD_DIR} \
|
-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} \
|
--env GOCACHE=${CORSO_BUILD_CACHE} --env GOMODCACHE=${CORSO_BUILD_MOD} --env GOTMPDIR=${CORSO_BUILD_DIR} \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user