Skip to content

Commit ec75b9f

Browse files
Migrate to built-in GH Actions (#377)
1 parent affa676 commit ec75b9f

File tree

2 files changed

+46
-30
lines changed

2 files changed

+46
-30
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ jobs:
3535
username: ${{ github.actor }}
3636
password: ${{ secrets.GITHUB_TOKEN }}
3737

38-
- name: Set up image tags and labels
38+
- name: Set up metadata
3939
id: meta
4040
uses: docker/metadata-action@v3
4141
with:
4242
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}
4343

44-
- name: Build image and push to the registry
44+
- name: Publish image on GHCR
4545
uses: docker/build-push-action@v2
4646
with:
4747
context: .

.github/workflows/release.yml

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ jobs:
1010
runs-on: ubuntu-latest
1111
env:
1212
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
13+
DOCKER_REGISTRY: hub.docker.com
14+
DOCKER_IMAGE_NAME: ${{ github.repository }}
1315
steps:
1416
- name: Check out the repo
1517
uses: actions/checkout@v2
@@ -21,6 +23,33 @@ jobs:
2123
with:
2224
install: true
2325

26+
- name: Log in to the registry
27+
uses: docker/login-action@v1
28+
with:
29+
registry: ${{ env.DOCKER_REGISTRY }}
30+
username: ${{ secrets.DOCKER_USERNAME }}
31+
password: ${{ secrets.DOCKER_PASSWORD }}
32+
33+
- name: Set up metadata
34+
id: meta
35+
uses: docker/metadata-action@v3
36+
with:
37+
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}
38+
tags: |
39+
type=pep440,pattern={{version}}
40+
type=pep440,pattern={{major}}
41+
type=pep440,pattern={{major}}.{{minor}}
42+
43+
- name: Set up metadata (-pytezos)
44+
id: meta-pytezos
45+
uses: docker/metadata-action@v3
46+
with:
47+
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}
48+
tags: |
49+
type=pep440,pattern={{version}}-pytezos
50+
type=pep440,pattern={{major}}-pytezos
51+
type=pep440,pattern={{major}}.{{minor}}-pytezos
52+
2453
- name: Set up Python
2554
uses: actions/setup-python@v2
2655
with:
@@ -38,37 +67,24 @@ jobs:
3867
- name: Run tests
3968
run: make test
4069

41-
- name: Generate semver labels
42-
uses: paulhatch/[email protected]
43-
id: version
70+
- name: Publish image on Docker Hub
71+
uses: docker/build-push-action@v2
4472
with:
45-
tag_prefix: ""
46-
format: "${major}.${minor}.${patch}"
73+
context: .
74+
file: Dockerfile
75+
push: true
76+
tags: ${{ steps.meta.outputs.tags }}
77+
labels: ${{ steps.meta.outputs.labels }}
4778

48-
- name: Set up enviroment
49-
run: |
50-
echo ::set-env name=RELEASE_VERSION::${GITHUB_REF#refs/*/}
51-
echo ::set-env name=MAJOR_VERSION::${{ steps.version.outputs.major }}
52-
echo ::set-env name=MINOR_VERSION::${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}
53-
54-
- name: Publish Docker image
55-
uses: elgohr/Publish-Docker-Github-Action@master
56-
with:
57-
name: dipdup/dipdup
58-
username: ${{ secrets.DOCKER_USERNAME }}
59-
password: ${{ secrets.DOCKER_PASSWORD }}
60-
tags: "${{ env.RELEASE_VERSION }},${{ env.MAJOR_VERSION }},${{ env.MINOR_VERSION }}"
61-
62-
- name: Publish Docker image (-pytezos)
63-
uses: elgohr/Publish-Docker-Github-Action@master
64-
env:
65-
EXTRAS: pytezos
79+
- name: Publish image on Docker Hub (-pytezos)
80+
uses: docker/build-push-action@v2
6681
with:
67-
name: dipdup/dipdup
68-
username: ${{ secrets.DOCKER_USERNAME }}
69-
password: ${{ secrets.DOCKER_PASSWORD }}
70-
tags: "${{ env.RELEASE_VERSION }}-pytezos,${{ env.MAJOR_VERSION }}-pytezos,${{ env.MINOR_VERSION }}-pytezos"
71-
buildargs: EXTRAS
82+
context: .
83+
file: Dockerfile
84+
push: true
85+
tags: ${{ steps.meta-pytezos.outputs.tags }}
86+
labels: ${{ steps.meta-pytezos.outputs.labels }}
87+
build-args: EXTRAS=pytezos
7288

7389
- name: Publish package on PyPi
7490
run: |

0 commit comments

Comments
 (0)