Shorten revision tag for pull requests #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow tests and releases a new version of the package. | |
name: Release | |
# Only trigger when a pull request into main branch is merged. | |
on: | |
pull_request: | |
types: [closed] | |
branches: | |
- main | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
uses: snok/install-poetry@v1.3.3 | |
- name: Get package version | |
id: get-package-version | |
run: echo "PACKAGE_VERSION=$(poetry version -s)" >> $GITHUB_OUTPUT | |
- name: Create Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, no need to create your own. | |
with: | |
tag_name: ${{ steps.get-package-version.outputs.PACKAGE_VERSION }} | |
release_name: ${{ github.event.pull_request.title }} | |
body: ${{ github.event.pull_request.body }} | |
draft: false | |
prerelease: false | |
outputs: | |
package_version: ${{ steps.get-package-version.outputs.PACKAGE_VERSION }} | |
docker: | |
runs-on: ubuntu-latest | |
needs: release | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Log in to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v3.1.1 | |
with: | |
context: . | |
push: true | |
tags: octue/get-deployment-info:${{ needs.release.outputs.package_version }},octue/get-deployment-info:latest |