-
Notifications
You must be signed in to change notification settings - Fork 151
60 lines (52 loc) · 1.69 KB
/
test-openapi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
on:
push:
branches:
- omarrida/openapi-test
jobs:
openapi:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"
- name: Install
run: yarn install
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: fernapi
password: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}
- name: Build CLI
working-directory: ./generators/openapi
run: yarn dist:cli
- name: Print Version
if: ${{ inputs.generator != 'openapi' }}
run: |
projectVersion=$(cat generators/openapi/VERSION)
echo $projectVersion
echo "VERSION=$projectVersion" >> $GITHUB_ENV
- name: Print Version Dev
if: ${{ inputs.generator == 'openapi' }}
run: |
projectVersion=$(cat generators/openapi/VERSION)
commitNumber=$(git log --oneline | wc -l )
sha_short=$(git rev-parse --short HEAD)
echo $projectVersion-$commitNumber-$sha_short
echo "VERSION=$projectVersion-$commitNumber-$sha_short" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./generators/openapi
file: ./generators/openapi/Dockerfile
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=min
push: true
tags: fernapi/omarrida-openapi:latest