| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- name: Build and Publish Test Image
- on:
- merge_group:
- types: [checks_requested]
- pull_request_target:
- branches:
- - develop
- env:
- REGISTRY: ghcr.io
- jobs:
- check_actor_permissions:
- runs-on: ubuntu-latest
- outputs:
- ismaintainer: ${{ steps.teamAffiliation.outputs.isTeamMember }}
- steps:
- - name: Check if actor is a maintainer
- uses: tspascoal/get-user-teams-membership@v2
- id: teamAffiliation
- with:
- GITHUB_TOKEN: ${{ secrets.ORG_READER_PAT }}
- username: ${{ github.actor }}
- team: opencost-maintainers
- build-and-publish-test-image:
- runs-on: ubuntu-latest
- needs: check_actor_permissions
- if: ${{ (always() && !cancelled()) && ( github.event_name == 'merge_group' || needs.check_actor_permissions.outputs.ismaintainer == 'true') }}
- permissions:
- contents: read
- packages: write
- steps:
- - name: Checkout Repo
- uses: actions/checkout@v4
- with:
- ref: ${{ github.event.merge_group.head_sha }}
- - name: Set SHA
- id: sha
- run: |
- echo "OC_SHORTHASH=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- - name: Set OpenCost Image Tags
- id: tags
- run: |
- echo "IMAGE_TAG=ghcr.io/${{ github.repository_owner }}/opencost:test-${{ steps.sha.outputs.OC_SHORTHASH }}" >> $GITHUB_OUTPUT
- - name: Build and publish container
- uses: ./.github/actions/build-container
- with:
- actor: ${{ github.actor }}
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- image_tag: ${{ steps.tags.outputs.IMAGE_TAG }}
- release_version: test-${{ steps.sha.outputs.OC_SHORTHASH }}
|