-
Notifications
You must be signed in to change notification settings - Fork 0
24 lines (23 loc) · 1011 Bytes
/
docker.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
name: Build and Push Container Image
on: [push]
env:
IMAGE_NAME: ghcr.io/4armed/metacreds
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Login to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Get version
id: vars
run: echo ::set-output name=tag::$(echo ${GITHUB_SHA} | cut -c1-7)
- name: Build the tagged Docker image
run: docker build . -f build/Dockerfile --tag ${{ env.IMAGE_NAME }}:${{steps.vars.outputs.tag}} --build-arg EXECUTABLE=metacreds
- name: Push the tagged Docker image
run: docker push ${{ env.IMAGE_NAME }}:${{steps.vars.outputs.tag}}
- name: Tag image as latest
run: docker tag ${{ env.IMAGE_NAME }}:${{steps.vars.outputs.tag}} ${{ env.IMAGE_NAME }}:latest
- name: Push latest
run: docker push ${{ env.IMAGE_NAME }}:latest