-
-
Notifications
You must be signed in to change notification settings - Fork 13
40 lines (38 loc) · 1.41 KB
/
branch-imager.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Branch Imager
on:
push:
branches-ignore:
- main
jobs:
Publish:
name: Publish image to container registries
runs-on: ubuntu-latest
if: "!(contains(github.event.head_commit.message, '[skip docker]'))"
steps:
- name: Checkout Project
uses: actions/checkout@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2.2.1
- name: Login to DockerHub
uses: docker/login-action@v2.1.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2.1.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get GitHub Branch Name
id: get_branch_name
run: echo ::set-output name=branch_name::$(echo $( [ -z "${{ github.head_ref }}" ] && echo ${{ github.ref }} | cut -c12- || echo ${{ github.head_ref }} ) | sed -e 's/\/\|_/-/g' | sed -e 's/@//g')
- name: Build and push Docker image
id: docker_build
uses: docker/build-push-action@v3.2.0
with:
push: true
context: .
tags: |
favware/graphql-pokemon:${{ steps.get_branch_name.outputs.branch_name }}
ghcr.io/favware/graphql-pokemon:${{ steps.get_branch_name.outputs.branch_name }}