remove workflow #64
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 Push | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: | |
contents: "read" | |
id-token: "write" | |
packages: "write" | |
env: | |
IMAGE: codecollection-devtools | |
DEFAULT_BRANCH: "origin/${{ github.event.repository.default_branch }}" | |
SHARED_ARTIFACT_REPOSITORY_PATH: "us-docker.pkg.dev/runwhen-nonprod-shared/public-images" | |
jobs: | |
build-and-push-gar: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- id: 'auth-runwhen' | |
name: 'Authenticate to Google Cloud' | |
uses: 'google-github-actions/[email protected]' | |
with: | |
workload_identity_provider: ${{ secrets.RUNWHEN_NONPROD_SHARED_WI_PROVIDER }} | |
service_account: ${{ secrets.RUNWHEN_NONPROD_SHARED_WI_SA }} | |
- name: Set tag to branch name | |
run: |- | |
echo "TAG=$(echo $GITHUB_REF_NAME | sed 's/[^a-zA-Z0-9]/-/g')-${GITHUB_SHA::8}" >> $GITHUB_ENV | |
- name: Build | |
run: |- | |
docker build \ | |
-t "${{env.SHARED_ARTIFACT_REPOSITORY_PATH }}/$IMAGE:$TAG" \ | |
-t "${{env.SHARED_ARTIFACT_REPOSITORY_PATH }}/$IMAGE:latest" \ | |
--build-arg GITHUB_SHA="$GITHUB_SHA" \ | |
--build-arg GITHUB_REF="$GITHUB_REF" \ | |
-f Dockerfile . | |
- name: Configure docker for GCP | |
run: gcloud --quiet auth configure-docker us-docker.pkg.dev | |
- name: Publish NonProd Shared Artifact Repo | |
id: publish-nonprod-shared-artifact-repo | |
run: |- | |
docker push "${{env.SHARED_ARTIFACT_REPOSITORY_PATH }}/$IMAGE" --all-tags | |
build-and-push-ghcr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Build | |
run: |- | |
docker build \ | |
-t "ghcr.io/${{ github.repository }}:latest" \ | |
-f Dockerfile . | |
- name: Push | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login --username ${{ github.actor }} --password-stdin ghcr.io | |
docker push ghcr.io/${{ github.repository }}:latest |