Skip to content

build, push and deploy #63

build, push and deploy

build, push and deploy #63

Workflow file for this run

name: build
run-name: build, push and deploy ${{ github.event.pull_request.head.ref }}
on:
push:
branches:
- main
jobs:
build:
name: "build"
runs-on: ubuntu-20.04
outputs:
version: ${{ steps.semantic.outputs.release-version }}
new-release-published: ${{ steps.semantic.outputs.new-release-published }}
steps:
- name: get repository files
uses: actions/checkout@v3
- uses: codfish/semantic-release-action@v2
with:
branches: |
[
'+([0-9])?(.{+([0-9]),x}).x',
'main',
'next',
'next-major',
{
name: 'beta',
prerelease: true
},
{
name: 'alpha',
prerelease: true
}
]
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: get version
if: steps.semantic.outputs.new-release-published == 'true'
run: |
VERSION=$RELEASE_VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "New version is $VERSION"
- name: Login to Docker Hub
if: steps.semantic.outputs.new-release-published == 'true'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: docker build and push
if: steps.semantic.outputs.new-release-published == 'true'
uses: nick-invision/retry@v2
with:
timeout_minutes: 3
max_attempts: 3
command: |
docker build . -t brunolombardi/vanir:$VERSION -t brunolombardi/vanir:latest
docker push brunolombardi/vanir:latest
docker push brunolombardi/vanir:$VERSION
deploy:
needs: [build]
if: needs.build.outputs.new-release-published == 'true'
name: "deploy"
uses: ./.github/workflows/deploy.yml
secrets: inherit
with:
version: ${{ needs.build.outputs.version }}