-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (71 loc) · 2.67 KB
/
container-publish.yaml
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
name: Container - Publish
on:
release:
types: [published]
jobs:
publish-container:
runs-on: ubuntu-latest
strategy:
matrix:
db_type:
- mongodb
- postgresql
- mariadb
- file
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up metadata
id: pkg_meta
run: |
echo "::set-output name=package_scope::@awesome-database-backup/awesome-${{ matrix.db_type }}-backup"
echo "::set-output name=package_path::apps/awesome-${{ matrix.db_type }}-backup"
echo "::set-output name=package_repository::weseek/awesome-${{ matrix.db_type }}-backup"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to docker.io registry
run:
echo ${{ secrets. DOCKER_REGISTRY_PASSWORD }} |
docker login --username ${{ secrets. DOCKER_REGISTRY_USERNAME }} --password-stdin
- name: Retrieve information from package.json
uses: myrotvorets/[email protected]
id: package-json
- name: Set up Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ steps.pkg_meta.outputs.package_repository }}
tags: |
type=raw,value=latest
type=semver,value=v${{ steps.package-json.outputs.packageVersion }},pattern={{major}}
type=semver,value=v${{ steps.package-json.outputs.packageVersion }},pattern={{major}}.{{minor}}
type=semver,value=v${{ steps.package-json.outputs.packageVersion }},pattern={{major}}.{{minor}}.{{patch}}
- name: Build and push container
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64
push: true
build-args: |
packageScope=${{ steps.pkg_meta.outputs.package_scope }}
packagePath=${{ steps.pkg_meta.outputs.package_path }}
dbType=${{ matrix.db_type }}
tags: ${{ steps.meta.outputs.tags }}
- name: Update Docker hub's description
uses: peter-evans/[email protected]
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
DOCKERHUB_REPOSITORY: ${{ steps.pkg_meta.outputs.package_repository }}
README_FILEPATH: ${{ steps.pkg_meta.outputs.package_path }}/README.md
slack-notification:
needs: publish-container
runs-on: ubuntu-latest
steps:
- name: Slack Notification
uses: weseek/ghaction-release-slack-notification@master
with:
channel: '#srv'
url: ${{ secrets.SLACK_WEBHOOK_URL }}
created_tag: ${{ github.ref_name }}