Create an auto-deploy file #3
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: golangci/[email protected] | |
name: Go Linting | |
- uses: hadolint/[email protected] | |
name: Docker Linting | |
# - name: MD Linting | |
# uses: actionshub/markdownlint@main | |
- name: Stay woke | |
uses: get-woke/woke-action@v0 | |
with: | |
fail-on-error: true | |
Build_Push_Image: | |
runs-on: ubuntu-latest | |
needs: code_quality_checks | |
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 }} | |
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: . | |
tags: ghcr.io/microsoft/azure-iothub-exporter:${{ env.IMAGE_TAG }}, ghcr.io/microsoft/azure-iothub-exporter: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 |