git.fiddlerwoaroof.com
Browse code

chore: readd gh workflow

Edward authored on 19/05/2021 09:17:59
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,50 @@
1
+name: Docker
2
+
3
+on:
4
+  push:
5
+    # Publish `master` as Docker `latest` image.
6
+    branches:
7
+      - master
8
+
9
+env:
10
+  # TODO: Change variable to your image's name.
11
+  IMAGE_NAME: sbcl-static
12
+
13
+jobs:
14
+
15
+  # Push image to GitHub Packages.
16
+  # See also https://docs.docker.com/docker-hub/builds/
17
+  push:
18
+    runs-on: ubuntu-latest
19
+    if: github.event_name == 'push'
20
+
21
+    steps:
22
+      - uses: actions/checkout@v2
23
+
24
+      - name: Build image
25
+        run: docker build . --file Dockerfile --tag $IMAGE_NAME
26
+
27
+      - name: Log into registry
28
+        run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
29
+
30
+      - name: Push image
31
+        run: |
32
+          IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
33
+
34
+          # Change all uppercase to lowercase
35
+          IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
36
+
37
+          # Strip git ref prefix from version
38
+          VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
39
+
40
+          # Strip "v" prefix from tag name
41
+          [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
42
+
43
+          # Use Docker `latest` tag convention
44
+          [ "$VERSION" == "master" ] && VERSION=latest
45
+
46
+          echo IMAGE_ID=$IMAGE_ID
47
+          echo VERSION=$VERSION
48
+
49
+          docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
50
+          docker push $IMAGE_ID:$VERSION
0 51
\ No newline at end of file