Skip to content

Commit 6970f70

Browse files
committed
add new workflow to push image to docker image
1 parent b8c5621 commit 6970f70

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Push docker image to docker hub
2+
3+
on:
4+
release:
5+
types: [created]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-and-push:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Get code access
14+
uses: actions/checkout@v3
15+
16+
- name: Extract version number
17+
id: extract_version
18+
run: |
19+
VERSION=$(git describe --tags --abbrev=0)
20+
echo "RELEASE_VERSION=${VERSION}" >> $GITHUB_ENV
21+
22+
- name: Log in to Docker Hub
23+
uses: docker/login-action@v2
24+
with:
25+
username: ${{ secrets.DOCKER_USERNAME }}
26+
password: ${{ secrets.DOCKER_PASSWORD }}
27+
28+
- name: Build Docker image
29+
run: |
30+
docker build -t ${{ secrets.DOCKER_USERNAME }}/f1-api-node:${{ env.RELEASE_VERSION }} .
31+
32+
- name: Push Docker image
33+
run: |
34+
docker push ${{ secrets.DOCKER_USERNAME }}/f1-api-node:${{ env.RELEASE_VERSION }}
35+

.github/workflows/publish.yml renamed to .github/workflows/publish-npm.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ jobs:
1111
steps:
1212
- name: Get code access
1313
uses: actions/checkout@v3
14+
1415
- name: Setup node environment
1516
uses: actions/setup-node@v3
1617
with:
1718
node-version: 16
1819
registry-url: https://registry.npmjs.org/
20+
1921
- name: Install dependencies
2022
run: npm ci
23+
2124
- name: Build Package
2225
run: npm run build
26+
2327
- name: Publish package
2428
run: npm publish
2529
env:

0 commit comments

Comments
 (0)