File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 1- # See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/
2-
31name : Fly Deploy
42on :
53 push :
97 deploy :
108 name : Deploy app
119 runs-on : ubuntu-latest
12- concurrency : deploy-group # optional: ensure only one action runs at a time
10+ concurrency : deploy-group
1311 steps :
1412 - uses : actions/checkout@v4
13+
1514 - uses : superfly/flyctl-actions/setup-flyctl@master
16- - run : flyctl deploy --local-only
15+
16+ - name : Deploy to Fly.io
17+ run : flyctl deploy --local-only --build-arg NPM_TOKEN=${{ secrets.GH_NPM_TOKEN }}
1718 env :
18- FLY_API_TOKEN : ${{ secrets.FLY_API_TOKEN }}
19- GH_NPM_TOKEN : ${{ secrets.GH_NPM_TOKEN }}
19+ FLY_API_TOKEN : ${{ secrets.FLY_API_TOKEN }}
Original file line number Diff line number Diff line change @@ -12,10 +12,15 @@ WORKDIR /app
1212# Set production environment
1313ENV NODE_ENV="production"
1414
15+ # Argument for NPM token
16+ ARG NPM_TOKEN
1517
1618# Throw-away build stage to reduce size of final image
1719FROM base as build
1820
21+ # Set the NPM_TOKEN as an environment variable
22+ ENV NPM_TOKEN=${NPM_TOKEN}
23+
1924# Install packages needed to build node modules
2025RUN apt-get update -qq && \
2126 apt-get install --no-install-recommends -y build-essential pkg-config python-is-python3
@@ -34,6 +39,8 @@ RUN bun run build
3439RUN rm -rf node_modules && \
3540 bun install --ci
3641
42+ # Remove .npmrc to avoid token leakage
43+ RUN rm -f .npmrc
3744
3845# Final stage for app image
3946FROM base
@@ -43,4 +50,4 @@ COPY --from=build /app /app
4350
4451# Start the server by default, this can be overwritten at runtime
4552EXPOSE 3000
46- CMD [ "bun" , "run" , "start" ]
53+ CMD [ "bun" , "run" , "start" ]
You can’t perform that action at this time.
0 commit comments