|
| 1 | +# This workflow tests the `octue/get-deployment-info` GitHub action. |
1 | 2 | name: test-deployment-info |
2 | 3 |
|
3 | 4 | on: |
4 | | - pull_request: |
5 | | - branches: |
6 | | - - main |
| 5 | + push: |
7 | 6 |
|
8 | 7 | jobs: |
9 | | - info: |
| 8 | + test-action: |
| 9 | + if: "!contains(github.event.head_commit.message, 'skipci')" |
10 | 10 | runs-on: ubuntu-latest |
11 | | - |
12 | 11 | timeout-minutes: 5 |
13 | | - |
14 | 12 | permissions: |
15 | 13 | contents: read |
16 | | - |
17 | 14 | steps: |
18 | 15 | - name: Checkout |
19 | 16 | uses: actions/checkout@v3 |
|
50 | 47 | echo ${{ steps.get-deployment-info.outputs.gcp_service_name }} |
51 | 48 | echo ${{ steps.get-deployment-info.outputs.version }} |
52 | 49 |
|
53 | | - - uses: nick-fields/assert-action@v1 |
| 50 | + - name: Get package version |
| 51 | + id: get-package-version |
| 52 | + run: echo "PACKAGE_VERSION=$(poetry version -s)" >> $GITHUB_OUTPUT |
| 53 | + |
| 54 | + - name: Get short SHA |
| 55 | + id: get-short-sha |
| 56 | + run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT |
| 57 | + |
| 58 | + - name: Inject slug/short variables |
| 59 | + uses: rlespinasse/github-slug-action@v4 |
| 60 | + |
| 61 | + - name: Check `branch_tag_kebab` |
| 62 | + uses: nick-fields/assert-action@v1 |
| 63 | + with: |
| 64 | + expected: ${{ env.GITHUB_REF_SLUG }} |
| 65 | + actual: ${{ steps.get-deployment-info.outputs.branch_tag_kebab }} |
| 66 | + |
| 67 | + - name: Check `image_latest_artefact` |
| 68 | + uses: nick-fields/assert-action@v1 |
54 | 69 | with: |
55 | | - expected: europe-west6-docker.pkg.dev/my-test-project/my-affix/my-test-service:-latest |
| 70 | + expected: europe-west6-docker.pkg.dev/my-test-project/my-affix/my-test-service:${{ env.GITHUB_REF_SLUG }}-latest |
56 | 71 | actual: ${{ steps.get-deployment-info.outputs.image_latest_artefact }} |
| 72 | + |
| 73 | + - name: Check `image_latest_tag` |
| 74 | + uses: nick-fields/assert-action@v1 |
| 75 | + with: |
| 76 | + expected: ${{ env.GITHUB_REF_SLUG }}-latest |
| 77 | + actual: ${{ steps.get-deployment-info.outputs.image_latest_tag }} |
| 78 | + |
| 79 | + - name: Check `image_version_artefact` |
| 80 | + uses: nick-fields/assert-action@v1 |
| 81 | + with: |
| 82 | + expected: europe-west6-docker.pkg.dev/my-test-project/my-affix/my-test-service:${{ env.GITHUB_REF_SLUG }}-unreleased |
| 83 | + actual: ${{ steps.get-deployment-info.outputs.image_version_artefact }} |
| 84 | + |
| 85 | + - name: Check `image_version_tag` |
| 86 | + uses: nick-fields/assert-action@v1 |
| 87 | + with: |
| 88 | + expected: ${{ env.GITHUB_REF_SLUG }}-unreleased |
| 89 | + actual: ${{ steps.get-deployment-info.outputs.image_version_tag }} |
| 90 | + |
| 91 | + - name: Check `short_sha` |
| 92 | + uses: nick-fields/assert-action@v1 |
| 93 | + with: |
| 94 | + expected: ${{ steps.get-short-sha.outputs.SHORT_SHA }} |
| 95 | + actual: ${{ steps.get-deployment-info.outputs.short_sha }} |
| 96 | + |
| 97 | + - name: Check `version_slug` |
| 98 | + uses: nick-fields/assert-action@v1 |
| 99 | + with: |
| 100 | + expected: unreleased |
| 101 | + actual: ${{ steps.get-deployment-info.outputs.version_slug }} |
| 102 | + |
| 103 | + - name: Check `version` |
| 104 | + uses: nick-fields/assert-action@v1 |
| 105 | + with: |
| 106 | + expected: ${{ steps.get-package-version.outputs.PACKAGE_VERSION }} |
| 107 | + actual: ${{ steps.get-deployment-info.outputs.version }} |
0 commit comments