Skip to content

Commit 45705f4

Browse files
Andrej SajenkoAndrej Sajenko
Andrej Sajenko
authored and
Andrej Sajenko
committed
add publish step on tags
1 parent c81bde4 commit 45705f4

File tree

1 file changed

+24
-28
lines changed

1 file changed

+24
-28
lines changed

.github/workflows/gradle.yml

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,13 @@ name: CI
1010
on:
1111
push:
1212
branches: [ "main" ]
13+
tags: ["*"]
1314
pull_request:
1415
branches: [ "main" ]
1516

1617
jobs:
1718
build:
1819
runs-on: ubuntu-24.04
19-
# runs-on: ${{matrix.os}}
20-
# strategy:
21-
# matrix:
22-
# os: [ubuntu-24.04, ubuntu-latest]
2320

2421
steps:
2522
- uses: actions/checkout@v4
@@ -35,31 +32,30 @@ jobs:
3532
- name: Build with Gradle Wrapper
3633
run: ./gradlew build
3734

38-
- name: Build and Push Docker Image
39-
uses: mr-smithers-excellent/docker-build-push@v4
35+
- name: Archive build artifacts
36+
uses: actions/upload-artifact@v3
4037
with:
41-
image: asjn83/demo
42-
tag: latest
43-
registry: docker.io
44-
username: ${{ secrets.DOCKER_USERNAME }}
45-
password: ${{ secrets.DOCKER_PASSWORD }}
46-
47-
48-
dependency-submission:
49-
38+
name: build-artifacts
39+
path: |
40+
build/libs
41+
Dockerfile
42+
43+
publish:
44+
needs: build
45+
if: startsWith(github.ref, 'refs/tags/')
5046
runs-on: ubuntu-24.04
51-
permissions:
52-
contents: write
5347

5448
steps:
55-
- uses: actions/checkout@v4
56-
- name: Set up JDK 17
57-
uses: actions/setup-java@v4
58-
with:
59-
java-version: '17'
60-
distribution: 'temurin'
61-
62-
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
63-
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
64-
- name: Generate and submit dependency graph
65-
uses: gradle/actions/dependency-submission@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
49+
- name: Download build artifacts
50+
uses: actions/download-artifact@v3
51+
with:
52+
name: build-artifacts
53+
54+
- name: Build and Push Docker Image
55+
uses: mr-smithers-excellent/docker-build-push@v4
56+
with:
57+
image: asjn83/demo
58+
tag: latest
59+
registry: docker.io
60+
username: ${{ secrets.DOCKER_USERNAME }}
61+
password: ${{ secrets.DOCKER_PASSWORD }}

0 commit comments

Comments
 (0)