Fix release branch check: verify commit is in the correct branch (#369) #378
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: Push to main | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '**' | |
| env: | |
| QUAY_ORG: quay.io/flightctl | |
| QUAY_CHARTS: quay.io/flightctl/charts | |
| QUAY_STANDALONE_REPO: flightctl-ui | |
| QUAY_OCP_REPO: flightctl-ocp-ui | |
| jobs: | |
| generate-tags: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| image_tags: ${{ steps.get-tags.outputs.image_tags }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Generate image tags | |
| id: get-tags | |
| run: | | |
| if ${{ github.ref_type == 'tag' }}; then | |
| # The images tags will match the Release tag | |
| image_tags=( ${{ github.ref_name }} ) | |
| image_tags=${image_tags#v} # remove the leading v prefix for version | |
| echo "image_tags=${image_tags[@]}" >> $GITHUB_OUTPUT | |
| echo "image_tags=${image_tags[@]}" | |
| else | |
| version=$(git describe --long --tags --exclude latest) | |
| version=${version#v} # remove the leading v prefix for version | |
| # The images tags are taken from git | |
| image_tags=( latest-${GITHUB_SHA} latest ${version} ) | |
| echo "image_tags=${image_tags[@]}" >> $GITHUB_OUTPUT | |
| echo "image_tags=${image_tags[@]}" | |
| fi | |
| publish-flightctl-ui: | |
| runs-on: ubuntu-latest | |
| needs: [generate-tags] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build | |
| id: build | |
| uses: redhat-actions/buildah-build@v2 | |
| with: | |
| image: ${{ env.QUAY_STANDALONE_REPO }} | |
| tags: ${{ needs.generate-tags.outputs.image_tags }} | |
| labels: | | |
| org.flightctl.flightctl-ui.github.repository=${{ github.repository }} | |
| org.flightctl.flightctl-ui.github.actor=${{ github.actor }} | |
| org.flightctl.flightctl-ui.github.run_id=${{ github.run_id }} | |
| org.flightctl.flightctl-ui.github.sha=${{ github.sha }} | |
| org.flightctl.flightctl-ui.github.ref_name=${{ github.ref_name }} | |
| extra-args: | | |
| --ulimit nofile=10000:10000 | |
| containerfiles: Containerfile | |
| context: . | |
| - name: Validate FIPS | |
| id: fips | |
| run: | | |
| go install github.com/flightctl/fips-validator@latest | |
| TAGS=(${{ needs.generate-tags.outputs.image_tags }}) | |
| podman unshare -- $HOME/go/bin/fips-validator image ${{ steps.build.outputs.image }}:${TAGS[0]} | |
| - name: Push to Quay.io | |
| id: push | |
| uses: redhat-actions/push-to-registry@v2.7 | |
| with: | |
| image: ${{ steps.build.outputs.image }} | |
| tags: ${{ needs.generate-tags.outputs.image_tags }} | |
| registry: ${{ env.QUAY_ORG }} | |
| username: ${{ secrets.QUAY_FLIGHTCTL_INFRA_ROBOT_USERNAME }} | |
| password: ${{ secrets.QUAY_FLIGHTCTL_INFRA_ROBOT_PASSWORD }} | |
| publish-flightctl-ocp-ui: | |
| runs-on: ubuntu-latest | |
| needs: [generate-tags] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build | |
| id: build | |
| uses: redhat-actions/buildah-build@v2 | |
| with: | |
| image: ${{ env.QUAY_OCP_REPO }} | |
| tags: ${{ needs.generate-tags.outputs.image_tags }} | |
| labels: | | |
| org.flightctl.flightctl-ui.github.repository=${{ github.repository }} | |
| org.flightctl.flightctl-ui.github.actor=${{ github.actor }} | |
| org.flightctl.flightctl-ui.github.run_id=${{ github.run_id }} | |
| org.flightctl.flightctl-ui.github.sha=${{ github.sha }} | |
| org.flightctl.flightctl-ui.github.ref_name=${{ github.ref_name }} | |
| extra-args: | | |
| --ulimit nofile=10000:10000 | |
| containerfiles: Containerfile.ocp | |
| context: . | |
| - name: Validate FIPS | |
| id: fips | |
| run: | | |
| go install github.com/flightctl/fips-validator@latest | |
| TAGS=(${{ needs.generate-tags.outputs.image_tags }}) | |
| podman unshare -- $HOME/go/bin/fips-validator image ${{ steps.build.outputs.image }}:${TAGS[0]} | |
| - name: Push to Quay.io | |
| id: push | |
| uses: redhat-actions/push-to-registry@v2.7 | |
| with: | |
| image: ${{ steps.build.outputs.image }} | |
| tags: ${{ needs.generate-tags.outputs.image_tags }} | |
| registry: ${{ env.QUAY_ORG }} | |
| username: ${{ secrets.QUAY_FLIGHTCTL_INFRA_ROBOT_USERNAME }} | |
| password: ${{ secrets.QUAY_FLIGHTCTL_INFRA_ROBOT_PASSWORD }} |