v4.1.8 #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy Prod | |
on: | |
release: | |
types: [published] | |
env: | |
ENV: ${{ vars.ENV }} | |
jobs: | |
docker-build: | |
runs-on: ubuntu-latest | |
environment: production | |
outputs: | |
image-version: ghcr.io/archway-network/archway-docs:${{ steps.meta.outputs.version }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
# TODO: ghrc credentials need to be moved to a shared infra | |
# account | |
username: 'shahbazn' | |
password: ${{ secrets.GHCR_ACCESS_TOKEN }} | |
- name: Set Docker Metadata | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ghcr.io/archway-network/archway-docs | |
tags: | | |
type=semver,pattern={{raw}} | |
type=sha | |
- name: Build and push docker image | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
secrets: | | |
ALGOLIA_APPLICATION_ID=${{ secrets.ALGOLIA_APPLICATION_ID }} | |
ALGOLIA_SEARCH_API_KEY=${{ secrets.ALGOLIA_SEARCH_API_KEY }} | |
ALGOLIA_WRITE_API_KEY=${{ secrets.ALGOLIA_WRITE_API_KEY }} | |
ALGOLIA_INDEX=${{ secrets.ALGOLIA_INDEX }} | |
ENV=${{ vars.ENV }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
deploy: | |
runs-on: ubuntu-latest | |
environment: production | |
needs: | |
- docker-build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Update Manifests | |
run: | | |
sed -i -e "s|IMAGE_VERSION|${{ needs.docker-build.outputs.image-version }}|g" ci/prod.yaml | |
sed -i -e "s|ALGOLIA_APPLICATION_ID_B64|$(echo -n ${{ secrets.ALGOLIA_APPLICATION_ID }}| base64)|g" ci/prod.yaml | |
sed -i -e "s|ALGOLIA_SEARCH_API_KEY_B64|$(echo -n ${{ secrets.ALGOLIA_SEARCH_API_KEY }}| base64)|g" ci/prod.yaml | |
sed -i -e "s|ALGOLIA_WRITE_API_KEY_B64|$(echo -n ${{ secrets.ALGOLIA_WRITE_API_KEY }}| base64)|g" ci/prod.yaml | |
sed -i -e "s|ALGOLIA_INDEX_B64|$(echo -n ${{ secrets.ALGOLIA_INDEX }}| base64)|g" ci/prod.yaml | |
sed -i -e "s|ENV_B64|$(echo -n ${{ vars.ENV }}| base64)|g" ci/prod.yaml | |
- name: Deploy | |
uses: steebchen/[email protected] | |
with: | |
config: ${{ secrets.GKE_SHARED_NONPROD_KUBECONFIG_B64 }} | |
command: apply -n archway-docs -f ci/prod.yaml |