|
| 1 | +name: File Transform and Upload |
| 2 | +description: Deploy an application specification to a Kubernetes cluster |
| 3 | +inputs: |
| 4 | + source-directory: |
| 5 | + description: Directory containing the source files to copy |
| 6 | + required: true |
| 7 | + target-directory: |
| 8 | + description: Directory to copy the files |
| 9 | + required: true |
| 10 | + clean-target-directory: |
| 11 | + description: Whether to clean the application directory before copying new files |
| 12 | + required: true |
| 13 | + default: true |
| 14 | + organization: |
| 15 | + description: GitHub organization where the GitOps repository is located |
| 16 | + required: true |
| 17 | + repository: |
| 18 | + description: Name of the GitHub repository |
| 19 | + required: true |
| 20 | + ref: |
| 21 | + description: Ref to deploy to files to |
| 22 | + required: true |
| 23 | + version: |
| 24 | + description: New version of the app |
| 25 | + required: true |
| 26 | + github-app-id: |
| 27 | + description: GitHub App ID used for reading helm chart |
| 28 | + required: true |
| 29 | + github-app-private-key: |
| 30 | + description: GitHub App Private Key used for reading helm chart |
| 31 | + required: true |
| 32 | + |
| 33 | +runs: |
| 34 | + using: composite |
| 35 | + steps: |
| 36 | + - name: Get token for GitOps repository checkout |
| 37 | + id: token |
| 38 | + uses: getsentry/action-github-app-token@v2 |
| 39 | + with: |
| 40 | + app_id: ${{ inputs.github-app-id }} |
| 41 | + private_key: ${{ inputs.github-app-private-key }} |
| 42 | + scope: ${{ inputs.organization }} |
| 43 | + |
| 44 | + - name: Checkout code |
| 45 | + uses: actions/checkout@v4 |
| 46 | + with: |
| 47 | + path: app-repo |
| 48 | + |
| 49 | + - name: Checkout target repository |
| 50 | + uses: actions/checkout@v4 |
| 51 | + with: |
| 52 | + repository: ${{ inputs.organization }}/${{ inputs.repository }} |
| 53 | + token: ${{ steps.token.outputs.token }} |
| 54 | + ref: ${{ inputs.ref }} |
| 55 | + path: target-repo |
| 56 | + |
| 57 | + - name: Clean target directory |
| 58 | + if: ${{ inputs.clean-app-directory == 'true' }} |
| 59 | + shell: bash |
| 60 | + run: | |
| 61 | + rm -rf ${{ github.workspace }}/target-repo/${{ inputs.target-directory }}/* |
| 62 | +
|
| 63 | + - name: Transform files |
| 64 | + shell: bash |
| 65 | + run: | |
| 66 | + bash ${{ github.action_path }}/transform.sh \ |
| 67 | + --target-dir ${{ github.workspace }}/app-repo/${{ inputs.source-directory }} \ |
| 68 | + --version ${{ inputs.version }} |
| 69 | +
|
| 70 | + - name: Copy files |
| 71 | + shell: bash |
| 72 | + run: | |
| 73 | + bash ${{ github.action_path }}/upload.sh \ |
| 74 | + --source-dir ${{ github.workspace }}/app-repo/${{ inputs.source-directory }} \ |
| 75 | + --target-dir ${{ github.workspace }}/target-repo/${{ inputs.target-directory }} \ |
| 76 | + --branch ${{ inputs.ref }} |
0 commit comments