Skip to content

Commit 7f4c6ac

Browse files
committed
Remove deprecated set-output in GitHub workflow for release
Completely removing the intermediate step calculating the tag_name as GitHub Actions is now providing this value in the context directly. See https://github.com/orgs/community/discussions/26686 and https://docs.github.com/en/actions/learn-github-actions/contexts#github-context fixes com-pas#65 Signed-off-by: Aurélien Pupier <[email protected]>
1 parent e0e6ccb commit 7f4c6ac

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

docs/GITHUB_ACTIONS.md

+5-11
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,6 @@ jobs:
197197
with:
198198
username: ${{ secrets.DOCKER_HUB_USERNAME }}
199199
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
200-
- name: Extract tag name #(3)
201-
id: extract_tagname
202-
shell: bash
203-
# Extra the tagname form the git reference, value of GITHUB_REF will be something like refs/tags/<tag_name>.
204-
run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})"
205200
- name: Set up JDK 11
206201
uses: actions/[email protected]
207202
with:
@@ -210,21 +205,20 @@ jobs:
210205
- name: Create custom Maven Settings.xml
211206
uses: whelk-io/maven-settings-xml-action@v18
212207
with:
213-
output_file: custom_maven_settings.xml #(4)
208+
output_file: custom_maven_settings.xml #(3)
214209
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
215210
- name: Set version with Maven
216-
run: mvn -B versions:set -DprocessAllModules=true -DnewVersion=${{ steps.extract_tagname.outputs.tagname }}
217-
- name: Deploy with Maven to GitHub Packages and Docker Hub #(5)
211+
run: mvn -B versions:set -DprocessAllModules=true -DnewVersion=${{ github.ref_name }}
212+
- name: Deploy with Maven to GitHub Packages and Docker Hub #(4)
218213
run: ./mvnw -B -s custom_maven_settings.xml -Prelease,native clean deploy
219214
```
220215

221216
A few points to remember:
222217
- (1): By default, the docker image is only deployed on release. This way we have a strict deployment flow, and versions always have the same content. For more information about types of releases, check the [Github Actions documentation](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#release).
223218
- (2): Before deploying to Docker Hub, we need to login first. This can be done by executing a GitHub Action. In this example, `DOCKER_HUB_USERNAME` and `DOCKER_HUB_PASSWORD` are used, which are secrets stored at [CoMPAS organization](https://github.com/organizations/com-pas/settings/secrets/actions). For more information about the username and password, ask in the the [Slack channel](https://app.slack.com/client/TLU68MTML).
224-
- (3): Extract the tag name from Git and use that as version to be set with Maven (${{ steps.extract_tagname.outputs.tagname }}).
225-
- (4): Creates a custom `settings.xml` having the credentials for the Github Packages.
219+
- (3): Creates a custom `settings.xml` having the credentials for the Github Packages.
226220
For more information, check our [Contributing](https://github.com/com-pas/contributing/blob/master/CONTRIBUTING.md).
227-
- (5): Building and publishing the docker image is build tool / framework specific. By default, CoMPAS services are using Quarkus and Maven. Deploying to Docker Hub is quite easy using Quarkus and maven, it's just a matter of building in combination with setting some properties. In this example, we use the `quarkus-profile` parameter instead of including all the parameters. This way, we can define profile specific properties in our `application.properties` file (For more information about this, check our [Docker Hub Deployment page](./DEPLOYMENT.md)):
221+
- (4): Building and publishing the docker image is build tool / framework specific. By default, CoMPAS services are using Quarkus and Maven. Deploying to Docker Hub is quite easy using Quarkus and maven, it's just a matter of building in combination with setting some properties. In this example, we use the `quarkus-profile` parameter instead of including all the parameters. This way, we can define profile specific properties in our `application.properties` file (For more information about this, check our [Docker Hub Deployment page](./DEPLOYMENT.md)):
228222

229223
```ini
230224
%publishNativeImage.quarkus.native.container-build=true

0 commit comments

Comments
 (0)