Merge pull request #69 from Azure/fix/ci-permission-failure #131
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: CI | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
code_quality_checks: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: TrueBrain/actions-flake8@master | |
name: Linting | |
if: "true" | |
with: | |
path: ./src | |
- uses: hadolint/[email protected] | |
name: Docker Linting | |
with: | |
dockerfile: ./src/Dockerfile | |
- name: MD Linting | |
uses: actionshub/markdownlint@main | |
- name: Stay woke | |
uses: get-woke/woke-action@v0 | |
with: | |
# Cause the check to fail on any broke rules | |
fail-on-error: true | |
Build_Push_Image: | |
runs-on: ubuntu-latest | |
needs: code_quality_checks | |
permissions: | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate Image Tag | |
run: | | |
# IMAGE_TAG=${{ secrets.MAJOR_VERSION }}.${{ secrets.MINOR_VERSION }}.${{ secrets.HF_VERSION }}-${{ github.run_number }} | |
IMAGE_TAG=${{ secrets.MAJOR_VERSION }}.${{ secrets.MINOR_VERSION }}.${{ secrets.HF_VERSION }} | |
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV | |
echo $IMAGE_TAG > $GITHUB_WORKSPACE/IMAGE_TAG | |
- name: Build and Push to Docker Hub | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
context: ./src | |
tags: ghcr.io/azure/gitops-connector:${{ env.IMAGE_TAG }}, ghcr.io/azure/gitops-connector:latest | |
- name: Upload Image Tags | |
uses: actions/[email protected] | |
with: | |
name: image_tags | |
path: ${{ github.workspace }}/IMAGE_TAG | |
- name: Upload Manifests Templates | |
uses: actions/[email protected] | |
with: | |
name: manifests | |
path: ${{ github.workspace }}/manifests |