-
Notifications
You must be signed in to change notification settings - Fork 120
61 lines (56 loc) · 1.8 KB
/
release-image.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
50
51
52
53
54
55
56
57
58
59
60
61
name: release-verifiable-image
on:
push:
branches:
- "master"
release:
types:
- edited
- prereleased
- published
env:
IMAGE_NAME: useink/contracts-verifiable
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
environment: master_and_tags
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
- name: Build and push Docker image from master
if: ${{ github.event_name == 'push' }}
uses: docker/build-push-action@v5
with:
context: .
file: ./build-image/Dockerfile
push: true
build-args: |
CARGO_CONTRACT_GIT=https://github.com/use-ink/cargo-contract
CARGO_CONTRACT_BRANCH=master
tags: |
${{ env.IMAGE_NAME }}:master
${{ env.IMAGE_NAME }}:latest
# Store the version, stripping any v-prefix
- name: Write release version
if: ${{ github.event_name == 'release' }}
run: |
GH_TAG=${{ github.event.release.tag_name }}
echo Published github tag: $GH_TAG
echo "DOCKER_TAG=${GH_TAG#v}" >> $GITHUB_ENV
- name: Build and push Docker image from release
if: ${{ github.event_name == 'release' }}
uses: docker/build-push-action@v5
with:
context: .
file: ./build-image/Dockerfile
push: true
build-args: |
CARGO_CONTRACT_GIT=https://github.com/use-ink/cargo-contract
CARGO_CONTRACT_TAG=${{ github.event.release.tag_name }}
tags: ${{ env.IMAGE_NAME }}:${{ env.DOCKER_TAG }}