This repository was archived by the owner on Jun 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (50 loc) · 1.86 KB
/
build-deploy.yml
File metadata and controls
60 lines (50 loc) · 1.86 KB
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
name: Build `deploy` release
# Enable Buildkit and let compose use it to speed up image building
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
# We have to reference the release with the name `deploy` to get all the assets.
# Thus, we have to delete the old tag / release on every deploy. Deleting the tag right before
# creating a new one, caused some race conditions (the releases was marked as draft).
- name: Delete old `deploy` tag + release
uses: dev-drprasad/delete-tag-and-release@v0.2.1
with:
delete_release: true
tag_name: deploy
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Checkout code repository
uses: actions/checkout@v2
- name: Build the image
run: docker build -t dataskop-prod -f docker/nk-production/Dockerfile .
- name: Create a container
run: docker create -ti --name dataskop-prod-container dataskop-prod bash
- name: Extract app folder
run: docker cp dataskop-prod-container:/app prodapp
- name: Compress
run: tar -czvf app-${{ github.sha }}.tar.gz prodapp
- name: Create new `deploy` tag + release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ github.sha }}
tag_name: deploy
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload tarball to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./app-${{ github.sha }}.tar.gz
asset_name: dataskop-platform.tar.gz
asset_content_type: application/gzip