Skip to content

adding pull preview - Don't merge these changes #18

adding pull preview - Don't merge these changes

adding pull preview - Don't merge these changes #18

Workflow file for this run

name: PullPreview
on:
pull_request:
types: [ labeled, unlabeled, synchronize, closed, reopened ]
jobs:
setup:
uses: communitiesuk/funding-service-design-workflows/.github/workflows/determine-jobs.yml@main
with:
environment: ${{ inputs.environment }}
docker-build:
runs-on: ubuntu-latest
needs: [ setup ]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: "Set version in env"
id: set-version
run: |
source version
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Docker metadata
id: metadata
uses: docker/metadata-action@v4
with:
images: ${{env.IMAGE_REPO_PATH}}/${{env.IMAGE_NAME}}
tags: |
type=sha,format=long
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=raw,value=${{env.VERSION}},enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=raw,value=latest
type=ref,event=branch
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push docker image
uses: docker/build-push-action@v4
with:
context: .
tags: ${{ steps.metadata.outputs.tags}}
labels: ${{ steps.metadata.outputs.labels }}
push: true
file: ./Dockerfile.pullpreview
build-args: |
LAST_TAG='${{env.VERSION}}'
LAST_COMMIT='${{ github.sha }}'
deploy:
needs: [ setup, docker-build ]
permissions:
contents: read # to fetch code (actions/checkout)
deployments: write # to delete deployments
pull-requests: write # to remove labels
statuses: write # to create commit status
id-token: write # This is required for AWS credentials
name: deploy
runs-on: ubuntu-latest
timeout-minutes: 30
environment: 'dev'
steps:
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT }}:role/GithubCopilotDeploy
role-session-name: FUNDING_SERVICE_DESIGN_FUND_APPLICATION_BUILDER_PULLPREVIEW
aws-region: eu-west-2
- uses: actions/checkout@v2
- name: Inject env specific values into docker compose
run: |
yq -i '.services.fab.image = "ghcr.io/communitiesuk/funding-service-design-fund-application-builder:sha-${{ github.sha }}"' docker-compose.pullpreview.yml
- uses: pullpreview/[email protected]
with:
compose_files: docker-compose.pullpreview.yml
ports: 8080/tcp
default_port: 8080
admins: gidsg