implement useTags #1
Workflow file for this run
This file contains hidden or 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
| name: Reusable Deployment | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| appName: | ||
| required: false | ||
| type: string | ||
| author: | ||
| required: true | ||
| description: The author of the change that triggers the deployment | ||
| type: string | ||
| useTags: | ||
| required: false | ||
| description: Push commits to env-named tags instead of main branch | ||
| detault: false | ||
| type: boolean | ||
| containerContext: | ||
| required: false | ||
| default: . | ||
| type: string | ||
| containerFile: | ||
| required: false | ||
| default: Containerfile | ||
| type: string | ||
| description: | ||
| required: true | ||
| description: The description of the change (e.g. the commit title) | ||
| type: string | ||
| env: | ||
| required: true | ||
| description: The application environment. Can be test, staging or prod. | ||
| type: string | ||
| namespace: | ||
| required: false | ||
| description: EKS namespace | ||
| type: string | ||
| ref: | ||
| required: false | ||
| description: The github ref to deploy | ||
| default: main | ||
| type: string | ||
| runner: | ||
| required: false | ||
| description: Runner type | ||
| default: ubuntu-latest | ||
| type: string | ||
| statusUrl: | ||
| required: false | ||
| description: The url that shows the status of the application | ||
| type: string | ||
| url: | ||
| required: false | ||
| description: The url where the application is served | ||
| type: string | ||
| versionKey: | ||
| required: false | ||
| type: string | ||
| secrets: | ||
| repoAccessToken: | ||
| required: true | ||
| description: The Github token to perform operations cross-repo (not secrets.GITHUB_TOKEN!) | ||
| jobs: | ||
| kubernetes: | ||
| runs-on: ${{ inputs.runner }} | ||
| steps: | ||
| - name: Checkout current git repository | ||
| uses: actions/checkout@v3 | ||
| - name: Load k8s deployment variables | ||
| id: k8s | ||
| run: | | ||
| if [[ "${{ inputs.env }}" == 'prod' ]] | ||
| then | ||
| URL="https://${{ inputs.appName }}.parcellab.dev" | ||
| STATUS_URL="https://argocd.${{ inputs.env }}.parcellab.dev/applications/${{ inputs.appName }}" | ||
| else | ||
| URL="https://${{ inputs.appName }}.${{ inputs.env }}.parcellab.dev" | ||
| STATUS_URL="https://argocd.${{ inputs.env }}.parcellab.dev/applications/${{ inputs.appName }}" | ||
| fi | ||
| # shellcheck disable=SC2086 | ||
| echo "url=$URL" >> $GITHUB_OUTPUT | ||
| # shellcheck disable=SC2086 | ||
| echo "status-url=$STATUS_URL" >> $GITHUB_OUTPUT | ||
| - name: Create Github deployment | ||
| uses: chrnorm/deployment-action@v2 | ||
| with: | ||
| auto-merge: false | ||
| environment: ${{ inputs.env }} | ||
| ref: ${{ inputs.ref }} | ||
| required-contexts: "" | ||
| payload: | | ||
| { | ||
| "author": ${{ toJSON(inputs.author) }}, | ||
| "description": ${{ toJSON(inputs.description) }}, | ||
| "env": ${{ toJSON(inputs.env) }}, | ||
| "name": "${{ inputs.appName }}", | ||
| "useTags": "${{ inputs.useTags }}" | ||
| "container": { | ||
| "context": "${{ inputs.containerContext }}", | ||
| "file": "${{ inputs.Containerfile }}" | ||
| }, | ||
| "kubernetes": { | ||
| "namespace": "${{ inputs.namespace }}", | ||
| "versionKey": "${{ inputs.versionKey }}" | ||
| }, | ||
| "statusUrl": ${{ toJSON(steps.k8s.outputs.status-url) }}, | ||
| "url": ${{ toJSON(steps.k8s.outputs.url) }} | ||
| } | ||
| production-environment: "${{ inputs.env == 'prod' }}" | ||
| transient-environment: "${{ inputs.env == 'test' }}" | ||
| token: ${{ secrets.repoAccessToken }} | ||