CI #609
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
name: CI | |
on: | |
schedule: | |
- cron: '30 2 * * *' | |
push: | |
env: | |
IMAGE_NAME: devinsolutions/osticket | |
jobs: | |
image: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Load image version | |
run: 'echo "IMAGE_VERSION=$(cat image-version)" >> $GITHUB_ENV' | |
- name: Generate image tags | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.IMAGE_NAME }} | |
flavor: | | |
latest=${{ github.ref_name == 'master' }} | |
tags: | | |
type=semver,pattern={{major}},value=${{ env.IMAGE_VERSION }} | |
type=semver,pattern={{major}}.{{minor}},value=${{ env.IMAGE_VERSION }} | |
type=semver,pattern={{version}},value=${{ env.IMAGE_VERSION }} | |
- name: Login to DockerHub | |
if: github.ref_name == 'master' | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build the image | |
uses: docker/build-push-action@v4 | |
with: | |
pull: true | |
push: ${{ github.ref_name == 'master' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest | |
cache-to: type=inline |