Skip to content

Commit

Permalink
Merge pull request #19 from jpedroh/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jpedroh authored Apr 28, 2021
2 parents 415a492 + b037364 commit ea03105
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Build API Docker image
run: docker build -t registry.heroku.com/mach-api/web -f ./packages/rest-api/Dockerfile .
run: docker build -t registry.heroku.com/mach-api/web --build-arg APP_VERSION_ARG=$(git tag | grep -E '^v[0-9]' | sort -V | tail -1) -f ./packages/rest-api/Dockerfile .
- name: Login to Heroku Container registry
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
Expand All @@ -50,10 +48,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Yarn install
run: yarn
- name: Set app version variable
run: export NEXT_PUBLIC_APP_VERSION=$(git tag | grep -E '^v[0-9]' | sort -V | tail -1)
- name: Run build
run: |
yarn workspace @mach/common build
Expand Down
2 changes: 1 addition & 1 deletion packages/front/components/footer-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const FooterNav: React.FC = () => {
</Nav.Item>
<Nav.Item>
<Nav.Link href="https://www.github.com/jpedroh/mach" target="_blank">
Mach v4.1.0
Mach {process.env.NEXT_PUBLIC_APP_VERSION}
</Nav.Link>
</Nav.Item>
<Nav.Item>
Expand Down
3 changes: 3 additions & 0 deletions packages/rest-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM node:lts-alpine AS base

ARG APP_VERSION_ARG=v0.0.0
ENV APP_VERSION=$APP_VERSION_ARG

WORKDIR /usr/src/app

COPY package.json .
Expand Down
7 changes: 6 additions & 1 deletion packages/rest-api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ app.use(function (req, res, next) {

app.get(
'/',
makeExpressCallback(() => require('../openapi.json'))
makeExpressCallback(async () => {
const version = process.env.APP_VERSION
const apiSpec = await require('../openapi.json')

return { ...apiSpec, ...{ info: { version } } }
})
)
app.get('/flights/', makeExpressCallback(actions.findAll))
app.get('/flights/:id', makeExpressCallback(actions.findById))
Expand Down

0 comments on commit ea03105

Please sign in to comment.