-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (29 loc) · 940 Bytes
/
golang.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
name: hexo-ci
on:
push:
branches: main
env:
IMAGE_NAME: gitproxy
jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: checkout
uses: actions/checkout@master
- name: build
run: |
docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
echo "${{ secrets.GITHUB_TOKEN }}"
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: push
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
VERSION=$(echo "${{ github.sha }}" | sed -e 's,.*/\(.*\),\1,')
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION