Skip to content

Commit

Permalink
Update build-test-deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
acdh-ch authored Jun 6, 2024
1 parent 8559666 commit fe7e0cd
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,34 @@ on:
jobs:
build:
name: Build Docker image from the branch ${{ github.ref_name }}
runs-on: ubuntu-24.04
runs-on: ubuntu-22.04
environment: ${{ github.ref_name }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: Pack Build
uses: dfreilich/[email protected]
with:
args: 'build tmp-cnb-image --builder heroku/builder:24_linux-amd64'
- name: Suggest default port 5000 within image
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up pack
uses: buildpacks/github-actions/[email protected]
- name: Build using heroku/buildpacks:22 CNB
env:
SECRETS_CONTEXT: ${{ toJson(secrets) }}
VARS_CONTEXT: ${{ toJson(vars) }}
PUBLIC_URL: ${{ inputs.PUBLIC_URL }}
run: |
echo -n "$SECRETS_CONTEXT" | jq -r '[to_entries[]|select(.key|startswith("K8S_SECRET_"))]|map("\(.key|sub("K8S_SECRET_"; ""))=\(.value|tostring|@sh)")|.[]' > secrets.env
cat >> Dockerfile <<EOF
echo -n "$SECRETS_CONTEXT" | jq -r '[to_entries[]|select(.key|startswith("K8S_SECRET_"))]|map("\(.key|sub("K8S_SECRET_"; ""))=\(.value|tostring)")|.[]' > secrets.env
echo -n "$VARS_CONTEXT" | jq -r '[to_entries[]|select(.key|startswith("K8S_SECRET_"))]|map("\(.key|sub("K8S_SECRET_"; ""))=\(.value|tostring)")|.[]' >> secrets.env
echo -n "$SECRETS_CONTEXT" | jq -r '[to_entries[]|select(.key|startswith("LC_K8S_SECRET_"))]|map("\(.key|sub("LC_K8S_SECRET_"; "")|ascii_downcase)=\(.value|tostring)")|.[]' >> secrets.env
echo -n "$VARS_CONTEXT" | jq -r '[to_entries[]|select(.key|startswith("LC_K8S_SECRET_"))]|map("\(.key|sub("LC_K8S_SECRET_"; "")|ascii_downcase)=\(.value|tostring)")|.[]' >> secrets.env
pack build tmp-cnb-image --env-file secrets.env --builder heroku/builder:22 \
--cache-image tmp-cnb-image:cache --publish
rm secrets.env
cat > Dockerfile <<EOF
ARG source_image
FROM tmp-cnb-image
ARG default_port
ENV PORT=5000
EXPOSE 5000
EXPOSE 5000
EOF
- name: login to github container registry
uses: docker/login-action@v3
Expand Down Expand Up @@ -56,7 +68,7 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
test:
name: Test code from the branch ${{ github.ref_name }}
runs-on: ubuntu-24.04
runs-on: ubuntu-22.04
environment: ${{ github.ref_name }}
steps:
- name: checkout
Expand Down

0 comments on commit fe7e0cd

Please sign in to comment.