Merge pull request #49 from replicatedhq/cbo/split-unit-and-pact #21
Workflow file for this run
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: publish | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
- 'v[0-9]+.[0-9]+.[0-9]+\-beta' | |
- 'v[0-9]+.[0-9]+.[0-9]+\-beta\.[0-9]+' | |
- 'v[0-9]+.[0-9]+.[0-9]+\-alpha' | |
- 'v[0-9]+.[0-9]+.[0-9]+\-alpha\.[0-9]+' | |
env: | |
PACT_VERSION: ${{ github.ref_name }} | |
PACT_BROKER_BASE_URL: ${{ vars.PACT_BROKER_BASE_URL }} | |
PACT_BROKER_TOKEN: ${{ secrets.PACT_BROKER_TOKEN }} | |
jobs: | |
make-tests: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '^1.20' | |
- run: make test | |
- run: make publish-pact | |
make-build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '^1.20' | |
- name: make build | |
run: make build | |
package-and-publish: | |
runs-on: 'ubuntu-22.04' | |
needs: | |
- make-tests | |
- make-build | |
steps: | |
- name: Get tag | |
id: tag | |
uses: dawidd6/action-get-tag@v1 | |
with: | |
strip_v: true | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: replicatedhq/action-install-pact@v1 | |
- name: Pact can-i-deploy | |
run: | | |
make can-i-deploy || echo "::warning:: can-i-deploy says no; provider(s) must successfully verify before release" | |
- name: Install Helm | |
uses: azure/setup-helm@v1 | |
with: | |
version: v3.10.1 | |
- uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
- name: Run Package and Publish | |
env: | |
REPLICATED_SDK_TAG: v${{steps.tag.outputs.tag}} | |
REPLICATED_SDK_REGISTRY: ghcr.io/replicatedhq # TODO: move to docker.io | |
CHART_VERSION: ${{steps.tag.outputs.tag}} | |
REPLICATED_USER_STAGING: ${{secrets.REPLICATED_USER_STAGING}} | |
REPLICATED_PASS_STAGING: ${{secrets.REPLICATED_PASS_STAGING}} | |
REPLICATED_USER_PROD: ${{secrets.REPLICATED_USER_PROD}} | |
REPLICATED_PASS_PROD: ${{secrets.REPLICATED_PASS_PROD}} | |
run: | | |
docker build --pull -t "$REPLICATED_SDK_REGISTRY/replicated:$REPLICATED_SDK_TAG" --build-arg git_tag=${{steps.tag.outputs.tag}} . | |
docker push "$REPLICATED_SDK_REGISTRY/replicated:$REPLICATED_SDK_TAG" | |
cd chart | |
envsubst < Chart.yaml.tmpl > Chart.yaml | |
envsubst < values.yaml.tmpl > values.yaml | |
rm -f *.tmpl | |
export CHART_NAME=`helm package . | rev | cut -d/ -f1 | rev` | |
echo pushing ${CHART_NAME} to staging | |
helm registry login registry.staging.replicated.com --username $REPLICATED_USER_STAGING --password $REPLICATED_PASS_STAGING | |
helm push $CHART_NAME oci://registry.staging.replicated.com/library | |
echo pushing ${CHART_NAME} to production | |
helm registry login registry.replicated.com --username $REPLICATED_USER_PROD --password $REPLICATED_PASS_PROD | |
helm push $CHART_NAME oci://registry.replicated.com/library | |
- name: Pact record-release | |
run: make record-release |