Skip to content

Add controller test for github webhook #209

Add controller test for github webhook

Add controller test for github webhook #209

Workflow file for this run

name: Build and publish container image
on:
push:
env:
TAG_NAME: octovy:${{ github.sha }}
GITHUB_IMAGE_REPO: ghcr.io/${{ github.repository_owner }}/octovy
GITHUB_IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/octovy:${{ github.sha }}
jobs:
build:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
steps:
- name: checkout
uses: actions/checkout@v2
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v1
- name: Build Docker image
run: docker build . -t ${{ env.TAG_NAME }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Rename image
run: docker tag ${{ env.TAG_NAME }} ${{ env.GITHUB_IMAGE_NAME }}
- name: Push image
run: docker push ${{ env.GITHUB_IMAGE_NAME }}
- uses: actions/checkout@v2
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_MESSAGE: "Pushed to ${{ env.GITHUB_IMAGE_NAME }}"
release-ghcr:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: checkout
uses: actions/checkout@v2
- name: extract tag
id: tag
run: |
TAG=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g")
echo ::set-output name=tag::$TAG
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull Docker image
run: docker pull ${{ env.GITHUB_IMAGE_NAME }}
- name: Rename Docker image (tag name)
run: docker tag ${{ env.GITHUB_IMAGE_NAME }} "${{ env.GITHUB_IMAGE_REPO }}:${{ steps.tag.outputs.tag }}"
- name: Rename Docker image (latest)
run: docker tag ${{ env.GITHUB_IMAGE_NAME }} "${{ env.GITHUB_IMAGE_REPO }}:latest"
- name: Push Docker image (tag name)
run: docker push "${{ env.GITHUB_IMAGE_REPO }}:${{ steps.tag.outputs.tag }}"
- name: Push Docker image (latest)
run: docker push "${{ env.GITHUB_IMAGE_REPO }}:latest"
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_MESSAGE: "Pushed to ${{ env.GITHUB_IMAGE_REPO }}:${{ steps.tag.outputs.tag }}"