aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/alpine-release.yml
blob: 5999fdaecc5018767fa2268f943be2e726fd31a8 (plain)
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
name: release docker image
on:
  push:
    tags:
      - '*'
    branches:
      - master
env:
  IMAGE_NAME: "gmid"
jobs:
  build:
    permissions: write-all
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1

    - name: build the image
      run: docker build -f contrib/Dockerfile -t gmid:alpine .

    - name: login to ghcr.io
      uses: docker/login-action@v2
      with:
        registry: ghcr.io
        username: ${{ github.actor }}
        password: ${{ secrets.GITHUB_TOKEN }}

    - name: push the image
      run: |
        IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
        IMAGE_ID=$(echo $IMAGE_ID | tr A-Z a-z)
        # strip git ref prefix from version
        VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
        echo IMAGE_ID=$IMAGE_ID
        echo VERSION=$VERSION
        docker tag gmid:alpine $IMAGE_ID:$VERSION
        docker push $IMAGE_ID:$VERSION