Skip to content

Commit

Permalink
Remove deprecated set-output in GitHub workflow for release
Browse files Browse the repository at this point in the history
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 #65

Signed-off-by: Aurélien Pupier <[email protected]>
  • Loading branch information
apupier committed Mar 10, 2023
1 parent 2f945b8 commit 91fd252
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions docs/GITHUB_ACTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,6 @@ jobs:
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Extract tag name #(3)
id: extract_tagname
shell: bash
# Extra the tagname form the git reference, value of GITHUB_REF will be something like refs/tags/<tag_name>.
run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})"
- name: Set up JDK 11
uses: actions/[email protected]
with:
Expand All @@ -210,21 +205,20 @@ jobs:
- name: Create custom Maven Settings.xml
uses: whelk-io/maven-settings-xml-action@v18
with:
output_file: custom_maven_settings.xml #(4)
output_file: custom_maven_settings.xml #(3)
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
- name: Set version with Maven
run: mvn -B versions:set -DprocessAllModules=true -DnewVersion=${{ steps.extract_tagname.outputs.tagname }}
- name: Deploy with Maven to GitHub Packages and Docker Hub #(5)
run: mvn -B versions:set -DprocessAllModules=true -DnewVersion=${{ github.ref_name }}
- name: Deploy with Maven to GitHub Packages and Docker Hub #(4)
run: ./mvnw -B -s custom_maven_settings.xml -Prelease,native clean deploy
```

A few points to remember:
- (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).
- (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).
- (3): Extract the tag name from Git and use that as version to be set with Maven (${{ steps.extract_tagname.outputs.tagname }}).
- (4): Creates a custom `settings.xml` having the credentials for the GitHub Packages.
- (3): Creates a custom `settings.xml` having the credentials for the GitHub Packages.
For more information, check our [Contributing](https://github.com/com-pas/contributing/blob/master/CONTRIBUTING.md).
- (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)):
- (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)):

```ini
%publishNativeImage.quarkus.native.container-build=true
Expand Down

0 comments on commit 91fd252

Please sign in to comment.