forked from itbm/postgresql-backup-s3
-
Notifications
You must be signed in to change notification settings - Fork 2
119 lines (102 loc) · 3.13 KB
/
build.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: CI-dev-pipeline
on:
push:
branches: [ master ]
tags:
- 'v*'
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
container:
image: lucasalt/act_base:latest
env:
S3_ACCESS_KEY_ID: myawskey
S3_SECRET_ACCESS_KEY: myawssecret
S3_ENDPOINT: http://s3:9000
S3_BUCKET: my-bucket
POSTGRES_USER: pg
POSTGRES_PASSWORD: pw
POSTGRES_DATABASE: test_db
POSTGRES_PORT: '5432'
POSTGRES_HOST: postgres
ENCRYPTION_PASSWORD: 'encryption_password'
steps:
- uses: actions/checkout@v2
- name: Chmod test-files for windows
run: chmod -R +x ./test
- name: Set up
run: ./test/setup.sh
- name: Test backup
run: ./test/test_backup.sh
- name: Test restore
run: ./test/test_restore.sh
env:
RESTORE: "latest"
- name: Tear down
run: ./test/tear_down.sh
- name: Set up Scheduled
run: ./test/setup.sh
- name: Test schedule backup
run: ./test/test_backup_schedule.sh
env:
SCHEDULE: "@every 5s"
DELETE_OLDER_THAN: "15 seconds ago"
- name: Test restore of scheduled backup
run: ./test/test_restore.sh
env:
RESTORE: "latest"
- name: Tear down
run: ./test/tear_down.sh
- name: Release
if: ${{ !env.ACT }}
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: false
title: "Development Build"
files: |
README.md
- name: Log in to Docker Hub
if: ${{ !env.ACT }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
if: ${{ !env.ACT }}
id: meta
uses: docker/metadata-action@v3
with:
images: richardwiden/postgresql-backup-s3
- name: Set up Docker Buildx
if: ${{ !env.ACT }}
id: buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
if: ${{ !env.ACT }}
uses: docker/build-push-action@v2
with:
context: docker
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Build and push Docker image
if: ${{ !env.ACT }}
uses: docker/build-push-action@v2
with:
context: docker
push: true
build-args: "POSTGRES_BASE_IMAGE=postgres:15-alpine"
tags: richardwiden/postgresql-backup-s3:15
labels: ${{ steps.meta.outputs.labels }}
- name: Update repo description
if: ${{ !env.ACT }}
uses: peter-evans/dockerhub-description@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: richardwiden/postgresql-backup-s3
readme-filepath: ./README.md