Skip to content

Strip hyphens and underscores from end of branch revision tags #91

Strip hyphens and underscores from end of branch revision tags

Strip hyphens and underscores from end of branch revision tags #91

Workflow file for this run

# This workflow tests the `octue/get-deployment-info` GitHub action.
name: test-deployment-info
on:
pull_request:
jobs:
get-package-version:
if: "!contains(github.event.head_commit.message, 'skipci')"
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
outputs:
version: ${{ steps.get-package-version.outputs.version }}
version_slug: ${{ steps.get-package-version.outputs.version_slug }}
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Install poetry
uses: snok/install-poetry@v1.3.3
- name: Get package version
id: get-package-version
run: |
echo "version=$(poetry version -s)" >> $GITHUB_OUTPUT
echo "version_slug=$(poetry version -s | tr . -)" >> $GITHUB_OUTPUT
docker:
runs-on: ubuntu-latest
needs: get-package-version
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- 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@v5.1.0
with:
context: .
push: true
tags: octue/get-deployment-info:${{ needs.get-package-version.outputs.version }}
test-action:
runs-on: ubuntu-latest
needs: [get-package-version, docker]
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Get deployment info
id: get-deployment-info
uses: ./
with:
gcp_project_name: my-test-project
gcp_project_number: 1234
gcp_region: europe-west6
gcp_resource_affix: my-affix
gcp_service_name: my-test-service
- name: Get short SHA
id: get-short-sha
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Check `branch_tag_kebab`
uses: nick-fields/assert-action@v1
with:
expected: refs-pull-${{ github.event.number }}-merge
actual: ${{ steps.get-deployment-info.outputs.branch_tag_kebab }}
- name: Check `image_latest_artifact`
uses: nick-fields/assert-action@v1
with:
expected: europe-west6-docker.pkg.dev/my-test-project/my-affix/my-test-service:refs-pull-${{ github.event.number }}-mer-latest
actual: ${{ steps.get-deployment-info.outputs.image_latest_artifact }}
- name: Check `image_latest_tag`
uses: nick-fields/assert-action@v1
with:
expected: refs-pull-${{ github.event.number }}-mer-latest
actual: ${{ steps.get-deployment-info.outputs.image_latest_tag }}
- name: Check `image_version_artifact`
uses: nick-fields/assert-action@v1
with:
expected: europe-west6-docker.pkg.dev/my-test-project/my-affix/my-test-service:refs-pull-${{ github.event.number }}-mer
actual: ${{ steps.get-deployment-info.outputs.image_version_artifact }}
- name: Check `image_version_tag`
uses: nick-fields/assert-action@v1
with:
expected: refs-pull-${{ github.event.number }}-mer
actual: ${{ steps.get-deployment-info.outputs.image_version_tag }}
- name: Check `short_sha`
uses: nick-fields/assert-action@v1
with:
expected: ${{ steps.get-short-sha.outputs.SHORT_SHA }}
actual: ${{ steps.get-deployment-info.outputs.short_sha }}
- name: Check `version`
uses: nick-fields/assert-action@v1
with:
expected: ${{ needs.get-package-version.outputs.version }}
actual: ${{ steps.get-deployment-info.outputs.version }}
- name: Check `version_slug`
uses: nick-fields/assert-action@v1
with:
expected: ${{ needs.get-package-version.outputs.version_slug }}
actual: ${{ steps.get-deployment-info.outputs.version_slug }}
- name: Check `revision_tag`
uses: nick-fields/assert-action@v1
with:
expected: refs-pull-${{ github.event.number }}-mer
actual: ${{ steps.get-deployment-info.outputs.revision_tag }}
- name: Check `revision_tag_slug`
uses: nick-fields/assert-action@v1
with:
expected: refs-pull-${{ github.event.number }}-mer
actual: ${{ steps.get-deployment-info.outputs.revision_tag_slug }}