Release version #108
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: Release version | |
permissions: | |
contents: write | |
issues: write | |
on: | |
push: | |
branches: | |
- master | |
- main | |
schedule: | |
- cron: '0 3 * * 0' | |
workflow_dispatch: | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
outputs: | |
app_version: ${{ steps.step1.outputs.app_version }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Nodejs | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm install @semantic-release/changelog @semantic-release/git @semantic-release/changelog @semantic-release/commit-analyzer @semantic-release/exec @semantic-release/git semantic-release/release-notes-generator | |
- name: Release | |
run: npx semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get the last tag via git and store in var | |
id: step1 | |
run: | | |
APP_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1)) | |
echo "${APP_VERSION}" | |
echo "name=app_version::${APP_VERSION}" >> ${GITHUB_OUTPUT} | |
docker-hub: | |
needs: release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: show app_version from release job | |
run: echo ${{ needs.release.outputs.app_version }} | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: docdee/filecheck | |
tags: | | |
type=ref,event=branch | |
type=raw,value=${{ needs.release.outputs.app_version }} | |
type=raw,value=latest | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |