Skip to content

Code clean up

Code clean up #26

Workflow file for this run

---
name: Release
on:
pull_request:
branches: [main, dev]
types:
- closed
push:
tags:
- "v*.*.*"
paths-ignore:
- 'CONTRIBUTING.md'
- 'README.md'
- 'docs/**'
workflow_dispatch:
permissions:
contents: write
packages: write
discussions: write
jobs:
# linter:
# name: Linter
# runs-on: [ubuntu-latest]
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: Setup Node 20
# uses: actions/setup-node@v4
# with:
# node-version: 20.12
# cache: 'npm'
# - name: Install dependencies
# run: |
# npm install
# - name: Run linter
# uses: github/super-linter@v6
# env:
# VALIDATE_ALL_CODEBASE: false
# VALIDATE_JAVASCRIPT_ES: true
# DEFAULT_BRANCH: main
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build
# needs: [ linter ]
runs-on: [ubuntu-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create release zip
run: zip -r release.zip .
if: success()
- name: Create artifact
uses: actions/upload-artifact@v4
with:
name: "app-${{ github.sha }}"
path: |
release.zip
# app/*.*
release:
name: Release
needs: [build]
runs-on: [ubuntu-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
run: echo ${{ github.sha }} > Release.txt
- name: Test
run: cat Release.txt
- name: Generate Changelog
run: echo "# Changelog" > ${{ github.workspace }}-CHANGELOG.txt
- name: Generate release notes
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: jacekzubielik/docker-oled-evo-sabre
with:
name: ${{ github.ref_name }}
# tag_name: v${{ steps.fetch-version.outputs.version }}
tag_name: ${{ needs.create_release.outputs.tag-name }}
files: |
release_${{ matrix.release_suffix }}
LICENCE
draft: false
prerelease: false
generate_release_notes: true
body_path: ${{ github.workspace }}-CHANGELOG.txt
image:
needs: [release]
runs-on: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
gorabbit/docker-oled-evo-sabre
ghcr.io/jacekzubielik/docker-oled-evo-sabre
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
# type=ref,event=tag
# type=match,pattern=\d.\d.\d
- name: Login to DockerHub
# if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64 #,linux/arm64