Merge pull request #2 from microsoft/revert-1-eedorenko/bring-gm-back #34
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: cicd | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
SEM_VER: 0.0.1 | |
APP_NAME: hello-world | |
IMAGE_NAME: ghcr.io/${{ github.repository }}/hello-world | |
jobs: | |
Build_Push_Image: | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- name: Checkout Source | |
uses: actions/checkout@v3 | |
- name: Login to ghcr | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate Image Tag | |
id: generate_image_tag | |
run: | | |
IMAGE_TAG=${{ env.SEM_VER }}-${{ github.run_number }} | |
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV | |
echo "::set-output name=image_tag::$IMAGE_TAG" | |
- name: Build and Push to ghcr | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
context: . | |
tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}, ${{ env.IMAGE_NAME }}:latest | |
outputs: | |
image_tag: ${{ steps.generate_image_tag.outputs.image_tag }} | |
Deploy_To_Dev: | |
runs-on: ubuntu-latest | |
needs: Build_Push_Image | |
environment: dev | |
steps: | |
- name: Checkout Source | |
uses: actions/[email protected] | |
- name: Checkout Configs | |
uses: actions/[email protected] | |
with: | |
ref: dev-configs | |
path: configs | |
- name: Read Image Tags | |
run: | | |
IMAGE_TAG=${{ needs.Build_Push_Image.outputs.image_tag }} | |
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV | |
VERSION=$IMAGE_TAG | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Generate Manifests for Functional Tests | |
run: | | |
.github/workflows/utils/generate-manifests.sh ${{ github.workspace }}/helm ${{ github.workspace }}/configs/functional-tests manifests/functional-test | |
- name: Generate Manifests for Performance Tests | |
run: | | |
.github/workflows/utils/generate-manifests.sh ${{ github.workspace }}/helm ${{ github.workspace }}/configs/performance-tests manifests/performance-test | |
- name: Create PR | |
run: | | |
.github/workflows/utils//create-pr.sh -s ${{ github.workspace }}/manifests -d . -r ${{ secrets.MANIFESTS_REPO }} -b dev -i ${{ github.run_number }} -t ${{ secrets.MANIFESTS_TOKEN }} -m Y | |
Deploy_To_Stage: | |
runs-on: ubuntu-latest | |
needs: [Build_Push_Image, Deploy_To_Dev] | |
environment: stage | |
steps: | |
- name: Checkout Source | |
uses: actions/[email protected] | |
- name: Checkout Configs | |
uses: actions/[email protected] | |
with: | |
ref: stage-configs | |
path: configs | |
- name: Read Image Tags | |
run: | | |
IMAGE_TAG=${{ needs.Build_Push_Image.outputs.image_tag }} | |
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV | |
VERSION=$IMAGE_TAG | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Generate Manifests for UAT | |
run: | | |
.github/workflows/utils/generate-manifests.sh ${{ github.workspace }}/helm ${{ github.workspace }}/configs/uat-tests manifests/uat-test | |
- name: Create PR | |
run: | | |
.github/workflows/utils//create-pr.sh -s ${{ github.workspace }}/manifests -d . -r ${{ secrets.MANIFESTS_REPO }} -b stage -i ${{ github.run_number }} -t ${{ secrets.MANIFESTS_TOKEN }} -m N | |