This repository has been archived by the owner on Sep 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (65 loc) · 2.42 KB
/
prod_deploy.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
61
62
63
64
65
66
67
name: Prod deploy
on:
push:
branches:
- 'main'
jobs:
prod_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
- uses: actions-ecosystem/action-bump-semver@v1
id: bump-semver
with:
current_version: ${{ steps.get-latest-tag.outputs.tag }}
level: patch
- uses: actions-ecosystem/action-push-tag@v1
with:
tag: ${{ steps.bump-semver.outputs.new_version }}
message: 'Release ${{ steps.bump-semver.outputs.new_version }}'
- name: "Set output"
id: set-output
run: echo "mix_drinks_backend_version=${{ steps.bump-semver.outputs.new_version }}" >> $GITHUB_ENV
- name: "Print output mix drinks backend version"
run: echo ${{ env.mix_drinks_backend_version }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
build-args: |
MIX_DRINKS_APP_VERSION=${{env.mix_drinks_backend_version}}
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/mixdrinks:${{env.mix_drinks_backend_version}}
${{ secrets.DOCKERHUB_USERNAME }}/mixdrinks:latest
- name: Setup docker compose prod
shell: bash
run: |
sed -e 's,build: .,image: 'vovochkastelmashchuk/mixdrinks:${{env.mix_drinks_backend_version}}',g' < docker-compose.yml >> docker-compose-prod.yml
cat docker-compose-prod.yml
- name: Setup docker compose prod
uses: yu-ichiro/spin-up-docker-compose-action@v1
with:
file: docker-compose-prod.yml
- name: Sleep for 60 seconds
run: sleep 60s
shell: bash
- name: Verify app is up
run: curl -v --fail http://localhost:8080/version || exit 1
- uses: matt-ball/newman-action@master
name: Run Postman tests on docker compose based on docker image with tag for production deployment
with:
collection: postman/api.json
environment: postman/env.json