-
Notifications
You must be signed in to change notification settings - Fork 6
39 lines (30 loc) · 1.75 KB
/
Copy pathBuildDeployContainer.yml
File metadata and controls
39 lines (30 loc) · 1.75 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
name: SimpleMailArchiveBuildAndDeploy
on: [push, pull_request]
jobs:
build:
runs-on: [ubuntu-latest]
steps:
- name: Checkout repo
uses: actions/checkout@v7
- name: Build container
run: docker build . -t axmeyer/simplemailarchive:test
- name: get release version
if: startsWith(github.ref, 'refs/tags/v') # make sure deploy only runs on tags with version number
run: echo "RELEASE_VERSION=${GITHUB_REF_NAME:1}" >> $GITHUB_ENV
- name: Echo version
if: startsWith(github.ref, 'refs/tags/v') # make sure deploy only runs on tags with version number
run: echo $RELEASE_VERSION
- name: tag container
if: startsWith(github.ref, 'refs/tags/v') # make sure deploy only runs on tags with version number
run: docker tag axmeyer/simplemailarchive:test axmeyer/simplemailarchive:$RELEASE_VERSION
- name: docker login
if: startsWith(github.ref, 'refs/tags/v') # make sure deploy only runs on tags with version number
run: echo ${{secrets.DOCKER_HUB_DEPLOY_KEY}} | docker login --username ${{secrets.DOCKER_HUB_USER}} --password-stdin
- name: push
if: startsWith(github.ref, 'refs/tags/v') # make sure deploy only runs on tags with version number
run: docker push axmeyer/simplemailarchive:$RELEASE_VERSION
- name: Push container as latest if version number does not start with '0.'
if: startsWith(github.ref, 'refs/tags/v') && startsWith(github.ref, 'refs/tags/v0.') != true
run: |
docker tag axmeyer/simplemailarchive:$RELEASE_VERSION axmeyer/simplemailarchive:latest
docker push axmeyer/simplemailarchive:latest