-
Notifications
You must be signed in to change notification settings - Fork 29
49 lines (40 loc) · 1.5 KB
/
version.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
41
42
43
44
45
46
47
48
49
name: Docker Version Release
on:
push:
tags:
- v*
jobs:
docker-version:
runs-on: ubuntu-latest
steps:
- name: checkout the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Build GH Container
run: |
echo ${{ secrets.GH_TOKEN }} | docker login --username ${{ secrets.GH_USERNAME }} --password-stdin ghcr.io
docker build --build-arg BRANCH=${{ steps.extract_branch.outputs.branch }} -t ghcr.io/drazzilb08/userscripts:${{ steps.get_version.outputs.VERSION }} .
docker push ghcr.io/drazzilb08/userscripts:${{ steps.get_version.outputs.VERSION }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
build-args: |
"BRANCH=${{ steps.extract_branch.outputs.branch }}"
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/userscripts:${{ steps.get_version.outputs.VERSION }}