|
| 1 | +--- |
| 2 | +name: Set Environment Variables |
| 3 | + |
| 4 | +inputs: |
| 5 | + VARIANT: |
| 6 | + description: "The desktop variant to build. Use 'ALL' to build all variants." |
| 7 | + required: false |
| 8 | + |
| 9 | +outputs: |
| 10 | + LATEST_TAG: |
| 11 | + description: "The latest tag based on the event type" |
| 12 | + value: ${{ steps.set.outputs.LATEST_TAG }} |
| 13 | + REGISTRY: |
| 14 | + description: "The container registry to use" |
| 15 | + value: ${{ steps.set.outputs.REGISTRY }} |
| 16 | + REGISTRY_USER: |
| 17 | + description: "The user for the container registry" |
| 18 | + value: ${{ steps.set.outputs.REGISTRY_USER }} |
| 19 | + PLATFORMS: |
| 20 | + description: "The platforms to build for" |
| 21 | + value: ${{ steps.set.outputs.PLATFORMS }} |
| 22 | + IMAGE_PATH: |
| 23 | + description: "The path to the image in the registry" |
| 24 | + value: ${{ steps.set.outputs.IMAGE_PATH }} |
| 25 | + IMAGE_NAME: |
| 26 | + description: "The name of the image" |
| 27 | + value: ${{ steps.set.outputs.IMAGE_NAME }} |
| 28 | + IMAGE_REF: |
| 29 | + description: "The full reference to the image in the registry" |
| 30 | + value: ${{ steps.set.outputs.IMAGE_REF }} |
| 31 | + VARIANTS: |
| 32 | + description: "The desktop variants to build" |
| 33 | + value: ${{ steps.set.outputs.VARIANTS }} |
| 34 | + MATRIX: |
| 35 | + description: "The matrix of variants to build" |
| 36 | + value: ${{ steps.set.outputs.MATRIX }} |
| 37 | + IS_SIGNED: |
| 38 | + description: "Whether the image is signed" |
| 39 | + value: ${{ steps.set.outputs.IS_SIGNED }} |
| 40 | + |
| 41 | +runs: |
| 42 | + using: "composite" |
| 43 | + steps: |
| 44 | + - name: Set environment variables |
| 45 | + id: set |
| 46 | + shell: bash |
| 47 | + run: | |
| 48 | + # Pick a latest tag based on the event type |
| 49 | + if [[ "${{ github.ref }}" != "refs/heads/${{ github.event.repository.default_branch }}" ]]; then |
| 50 | + echo "LATEST_TAG=${{ github.ref_name }}" >> $GITHUB_OUTPUT |
| 51 | + else |
| 52 | + echo "LATEST_TAG=latest" >> $GITHUB_OUTPUT |
| 53 | + fi |
| 54 | +
|
| 55 | + REGISTRY=ghcr.io |
| 56 | + REGISTRY_USER=${{ github.actor }} |
| 57 | + IMAGE_PATH=${{ github.repository_owner }} |
| 58 | + IMAGE_NAME=${{ github.event.repository.name }} |
| 59 | + PLATFORMS="amd64" |
| 60 | +
|
| 61 | + echo "REGISTRY=${REGISTRY}" >> $GITHUB_OUTPUT |
| 62 | + echo "REGISTRY_USER=${REGISTRY_USER}" >> $GITHUB_OUTPUT |
| 63 | + echo "IMAGE_PATH=${IMAGE_PATH}" >> $GITHUB_OUTPUT |
| 64 | + echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_OUTPUT |
| 65 | + echo "IMAGE_REF=${REGISTRY}/${IMAGE_PATH}/${IMAGE_NAME}" >> $GITHUB_OUTPUT |
| 66 | + echo "PLATFORMS=${PLATFORMS}" >> $GITHUB_OUTPUT |
| 67 | +
|
| 68 | + # This is a workaround so that the expansion of secrets.SIGNING_SECRET doesn't break the if statement |
| 69 | + SECRET=$(cat <<EOF |
| 70 | + ${{ secrets.SIGNING_SECRET }} |
| 71 | + EOF |
| 72 | + ) |
| 73 | + if [ -z "${SECRET}" ]; then |
| 74 | + echo "IS_SIGNED=false" >> $GITHUB_OUTPUT |
| 75 | + else |
| 76 | + echo "IS_SIGNED=true" >> $GITHUB_OUTPUT |
| 77 | + fi |
0 commit comments