-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
57f4d60
commit 9d19230
Showing
1 changed file
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Build and deploy | ||
|
||
on: | ||
push: | ||
tags: | ||
- '**' | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
|
||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: FranzDiebold/github-env-vars-action@v2 | ||
|
||
- name: Set major tag name | ||
run: echo "TAG_MAJOR=$(echo $CI_REF_NAME | cut -d. -f1)" >> $GITHUB_ENV | ||
|
||
- name: Set major tag name | ||
run: echo "TAG_MINOR=${{ env.TAG_MAJOR }}.$(echo $CI_REF_NAME | cut -d. -f2)" >> $GITHUB_ENV | ||
|
||
- name: Build image | ||
run: | | ||
docker build --no-cache \ | ||
-t baldissaramatheus/tasks.md:latest \ | ||
-t baldissaramatheus/tasks.md:$CI_REF_NAME \ | ||
-t baldissaramatheus/tasks.md:${{ env.TAG_MAJOR }} \ | ||
-t baldissaramatheus/tasks.md:${{ env.TAG_MINOR }} \ | ||
--target base . | ||
- name: Save Docker image as artifact | ||
run: | | ||
docker save -o /tmp/image.tar \ | ||
baldissaramatheus/tasks.md:latest \ | ||
baldissaramatheus/tasks.md:$CI_REF_NAME \ | ||
baldissaramatheus/tasks.md:${{ env.TAG_MAJOR }} \ | ||
baldissaramatheus:${{ env.TAG_MINOR }} | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: image | ||
path: /tmp/image.tar | ||
|
||
deploy: | ||
name: Deploy | ||
|
||
needs: [build] | ||
|
||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: FranzDiebold/github-env-vars-action@v2 | ||
|
||
- name: Set major tag name | ||
run: echo "TAG_MAJOR=$(echo $CI_REF_NAME | cut -d. -f1)" >> $GITHUB_ENV | ||
|
||
- name: Set major tag name | ||
run: echo "TAG_MINOR=${{ env.TAG_MAJOR }}.$(echo $CI_REF_NAME | cut -d. -f2)" >> $GITHUB_ENV | ||
|
||
- name: Download artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: image | ||
path: /tmp | ||
|
||
- name: Load Docker image | ||
run: | | ||
docker load --input /tmp/image.tar | ||
docker image ls -a | ||
- name: Push Docker image | ||
run: | | ||
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | ||
docker push --all-tags williarin/secure-mysql-backups |