Skip to content

Commit

Permalink
Update push workflow and use main branch as default (#20)
Browse files Browse the repository at this point in the history
* use main branch for default

* Remove stage to stage copy
  • Loading branch information
KevinMind authored Mar 15, 2024
1 parent cb1f9a6 commit 7719b6c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ runs:
- name: Validate inputs
shell: bash
run: |
if [[ "${{ inputs.push }}" == "true" && "${{ github.ref }}" == "refs/heads/master" ]]; then
echo "Cannot push to registry from master branch unless we migrate our master build job to GHA."
if [[ "${{ inputs.push }}" == "true" && "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "Cannot push to registry from main branch unless we migrate our main build job to GHA."
exit 1
fi
# Setup docker to build for multiple architectures
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
merge_group:
push:
branches:
- master
- main

jobs:
deploy_staging:
Expand All @@ -18,7 +18,7 @@ jobs:
echo "Deploying to staging"
# Your deployment script here
deploy_production:
if: ${{ github.event_name == 'push' }} && ${{ github.ref == 'refs/heads/master' }}
if: ${{ github.event_name == 'push' }} && ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
needs: deploy_staging
steps:
Expand Down
22 changes: 9 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
FROM node:18 as base


WORKDIR /app
COPY package*.json /app/

RUN /bin/bash <<EOF
npm install
EOF

FROM base as builder

COPY --from=base /app/node_modules /app/node_modules
COPY src package.json tsconfig.json /app/
RUN --mount=type=bind,src=package.json,dst=/app/package.json \
npm install

RUN npm run build
RUN \
--mount=type=bind,src=package.json,dst=/app/package.json \
--mount=type=bind,src=src,dst=/app/src/ \
--mount=type=bind,src=tsconfig.json,dst=/app/tsconfig.json \
npm run build

FROM base as final

COPY --from=builder /app/dist /app/dist
COPY --from=base /app/package.json /app/package.json
COPY --from=base /app/dist /app/dist
COPY package.json /app/package.json

RUN npm i --omit=dev --no-save

Expand Down

0 comments on commit 7719b6c

Please sign in to comment.