chore: don't use token for update image worklfow #326
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: CompanionPi Build | |
| permissions: {} | |
| on: | |
| push: | |
| branches: | |
| - main | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| inputs: | |
| # publish-branch: | |
| # type: choice | |
| # description: Release branch (on the website) | |
| # default: beta | |
| # options: | |
| # - stable | |
| # - beta | |
| # required: true | |
| companion-ref: | |
| type: string | |
| description: Companion tag to build as new stable | |
| default: beta | |
| required: true | |
| schedule: | |
| - cron: '0 0 * * SUN' | |
| concurrency: | |
| group: ${{ github.event.inputs.companion-ref || github.ref }} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| name: build image | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v5 | |
| - name: Determine build details | |
| id: info | |
| shell: bash | |
| run: | | |
| DATE=$(date +"%d-%m-%y") | |
| echo "sourcename=output-companionpi/image.gz" >> $GITHUB_OUTPUT | |
| if [[ "${{ github.event_name }}" == "push" || "${{ github.event_name }}" == "schedule" ]] | |
| then | |
| # Automatic beta build | |
| VERSION="0.0.0" | |
| echo "version=${VERSION}+${{ github.run_number }}-${DATE}" >> $GITHUB_OUTPUT | |
| echo "branch=beta" >> $GITHUB_OUTPUT | |
| echo "ref=beta" >> $GITHUB_OUTPUT | |
| echo "targetname=companion-pi-beta-${{ github.run_number }}-${DATE}.img.gz" >> $GITHUB_OUTPUT | |
| else | |
| # Manual stable build. We assume a semver tag was supplied | |
| echo "version=${{ github.event.inputs.companion-ref }}+${{ github.run_number }}-${DATE}" >> $GITHUB_OUTPUT | |
| echo "branch=stable" >> $GITHUB_OUTPUT | |
| echo "ref=${{ github.event.inputs.companion-ref }}" >> $GITHUB_OUTPUT | |
| echo "targetname=companion-pi-stable-${{ github.event.inputs.companion-ref }}-${DATE}.img.gz" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Do build | |
| uses: ./.github/actions/do-build | |
| with: | |
| companion-ref: ${{ steps.info.outputs.ref }} | |
| PACKER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload build | |
| uses: bitfocus/actions/upload-and-notify-for-branch@main | |
| with: | |
| source-filename: ${{ steps.info.outputs.sourcename }} | |
| destination-filename: ${{ steps.info.outputs.targetname }} | |
| s3-host: ${{ secrets.S3_HOST }} | |
| s3-bucket: ${{ secrets.S3_BUCKET }}/companion-pi | |
| s3-access-key: ${{ secrets.S3_KEY }} | |
| s3-secret-key: ${{ secrets.S3_SECRET }} | |
| api-version: ${{ steps.info.outputs.version }} | |
| api-branch: ${{ steps.info.outputs.branch }} | |
| api-product: companion-pi | |
| api-target: 'linux-img' | |
| api-secret: ${{ secrets.BITFOCUS_API_PROJECT_SECRET }} |