|
20 | 20 | run: if [[ "${{ steps.get_version.outputs.VERSION }}" == *"-SNAPSHOT" ]]; then exit 1; else exit 0; fi
|
21 | 21 | - name: Get release
|
22 | 22 | id: get_release
|
23 |
| - run: echo ::set-output name=RELEASE_HTTP_CODE::$(curl -s -o out.html -w '%{http_code}' https://github.com/les-projets-cagnottes/slack-events-catcher/releases/tag/${{ steps.get_version.outputs.VERSION }};) |
| 23 | + run: echo ::set-output name=RELEASE_HTTP_CODE::$(curl -s -o out.html -w '%{http_code}' https://github.com/les-projets-cagnottes/web/releases/tag/${{ steps.get_version.outputs.VERSION }};) |
24 | 24 | - name: Test release existence
|
25 | 25 | run: if [[ "${{ steps.get_release.outputs.RELEASE_HTTP_CODE }}" -eq "200" ]]; then exit 1; else exit 0; fi
|
26 | 26 |
|
@@ -67,56 +67,11 @@ jobs:
|
67 | 67 | - uses: actions/checkout@v2
|
68 | 68 | with:
|
69 | 69 | ref: '${{ needs.verify-version.outputs.version }}'
|
70 |
| - - name: Generate git ref in environment variables |
71 |
| - run: "sed -i -E \"s|gitRef: '(.*)'|gitRef: '$GITHUB_SHA'|g\" src/environments/environment.heroku.ts" |
72 | 70 | - name: Build the Docker image
|
73 |
| - run: docker build . --file Dockerfile --build-arg configuration=heroku-fr --tag docker.pkg.github.com/les-projets-cagnottes/web/web:heroku-${{ needs.verify-version.outputs.version }} |
74 |
| - - name: Login to Registry |
75 |
| - run: docker login docker.pkg.github.com -u thomah -p ${{secrets.GITHUB_TOKEN}} |
76 |
| - - name: Publish to Registry |
77 |
| - run: docker push docker.pkg.github.com/les-projets-cagnottes/web/web:heroku-${{ needs.verify-version.outputs.version }} |
78 |
| - |
79 |
| - deploy-production: |
80 |
| - needs: [verify-version, release] |
81 |
| - runs-on: ubuntu-latest |
82 |
| - steps: |
83 |
| - - uses: actions/checkout@v2 |
84 |
| - with: |
85 |
| - ref: '${{ needs.verify-version.outputs.version }}' |
86 |
| - - name: Use Node.js 10.x |
87 |
| - uses: actions/setup-node@v1 |
88 |
| - with: |
89 |
| - node-version: 10.x |
90 |
| - - name: Generate git ref in environment variables |
91 |
| - run: "sed -i -E \"s|gitRef: '(.*)'|gitRef: '$GITHUB_SHA'|g\" src/environments/environment.heroku.ts" |
92 |
| - - run: npm ci |
93 |
| - - run: npm run build -- --configuration production-fr --output-path=dist |
94 |
| - - name: Get the version |
95 |
| - id: get_version |
96 |
| - run: "echo ::set-output name=VERSION::$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')" |
97 |
| - - name: Create temp directory to copy files |
98 |
| - |
99 |
| - with: |
100 |
| - host: ${{ secrets.PRODUCTION_HOST }} |
101 |
| - username: ${{ secrets.PRODUCTION_USER }} |
102 |
| - key : ${{ secrets.PRODUCTION_KEY }} |
103 |
| - port: ${{ secrets.PRODUCTION_PORT }} |
104 |
| - script: mkdir -p /opt/les-projets-cagnottes/web/deployment |
105 |
| - - name: Copy content recursively to production |
106 |
| - |
107 |
| - with: |
108 |
| - host: ${{ secrets.PRODUCTION_HOST }} |
109 |
| - username: ${{ secrets.PRODUCTION_USER }} |
110 |
| - key : ${{ secrets.PRODUCTION_KEY }} |
111 |
| - port: ${{ secrets.PRODUCTION_PORT }} |
112 |
| - source: "dist,bin/deploy.sh" |
113 |
| - target: /opt/les-projets-cagnottes/web/deployment |
114 |
| - rm: true |
115 |
| - - name: Execute deployment remotely |
116 |
| - |
117 |
| - with: |
118 |
| - host: ${{ secrets.PRODUCTION_HOST }} |
119 |
| - username: ${{ secrets.PRODUCTION_USER }} |
120 |
| - key : ${{ secrets.PRODUCTION_KEY }} |
121 |
| - port: ${{ secrets.PRODUCTION_PORT }} |
122 |
| - script: (sudo chmod 755 /opt/les-projets-cagnottes/web/deployment/bin/deploy.sh) && (nohup /opt/les-projets-cagnottes/web/deployment/bin/deploy.sh ${{ steps.get_version.outputs.VERSION }} &> /opt/les-projets-cagnottes/web/deployment/bin/console.log < /dev/null &) && exit 0 |
| 71 | + run: docker build . --file Dockerfile --build-arg configuration=production --tag web:latest |
| 72 | + - name: Tag the image for Docker Hub |
| 73 | + run: docker tag web:latest lesprojetscagnottes/web:${{ steps.get_version.outputs.VERSION }} |
| 74 | + - name: Login to Docker Hub |
| 75 | + run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} |
| 76 | + - name: Publish to Docker Hub |
| 77 | + run: docker push lesprojetscagnottes/web:${{ steps.get_version.outputs.VERSION }} |
0 commit comments