Skip to content

Commit

Permalink
ci(workflow): update Docker CICD workflow to use semantic-release
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicconike committed Jun 12, 2024
1 parent f45e3a1 commit 4eb4ac9
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 47 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ __pycache__
Thumbs.db
build/
dist/
chromium
.git
.gitignore
.vscode
Expand Down
10 changes: 5 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
Expand All @@ -7,12 +6,13 @@ updates:
directory: "/"
schedule:
interval: "weekly"
reviewers:
- "nicoonike"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
reviewers:
- "nicoonike"

- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
35 changes: 19 additions & 16 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ jobs:
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKER_USERNAME }}/steam-stats
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}.{{patch}}
- name: Build & Push Docker Image
uses: docker/build-push-action@v5
Expand All @@ -63,30 +68,28 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

update-changelog:
permissions:
id-token: write
contents: write
runs-on: ubuntu-latest
needs: build-and-publish
if: success()
steps:
- name: Checkout code
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Extract release date from git tag
id: release_date
- name: Install Dependencies
run: |
echo "date=$(git log -1 --date=short --format=%ad '${{ github.event.release.tag_name }}')" >> $GITHUB_OUTPUT;
- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
release-date: ${{ steps.release_date.outputs.date }}
release-notes: ${{ github.event.release.body }}
latest-version: ${{ github.event.release.tag_name }}
python -m pip install --upgrade pip
pip install python-semantic-release
- name: Commit Updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v5
- name: Semantic Release
uses: python-semantic-release/python-semantic-release@v9.8.1
with:
branch: master
commit_message: Update CHANGELOG
file_pattern: CHANGELOG.md
github_token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 8 additions & 0 deletions .github/workflows/steam-stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ on:
# Runs every Monday at 12AM IST (UTC+5:30)
- cron: "30 18 * * 0"
workflow_dispatch:
push:
branches:
- master
paths:
- '**/*.yml'
- '**/*.py'
pull_request:
branches:
- master
Expand All @@ -15,6 +21,8 @@ jobs:
update-readme:
name: Steam Stats
runs-on: ubuntu-latest
container:
image: nicconike/steam-stats:master
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.0] - 2024-06-10

### Added
- Initial release
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![CodeQL](https://github.com/Nicconike/Steam-Stats/actions/workflows/github-code-scanning/codeql/badge.svg?branch=master)](https://github.com/Nicconike/Steam-Stats/actions/workflows/github-code-scanning/codeql)
[![Pylint](https://github.com/Nicconike/Steam-Stats/actions/workflows/pylint.yml/badge.svg)](https://github.com/Nicconike/Steam-Stats/actions/workflows/pylint.yml)
![pylint](https://img.shields.io/badge/PyLint-10.00-brightgreen?logo=python&logoColor=white)
![GitHub repo size](https://img.shields.io/github/repo-size/nicconike/steam-stats)
![GitHub License](https://img.shields.io/github/license/nicconike/Steam-Stats)
[![Visitor Badge](https://badges.pufler.dev/visits/nicconike/steam-stats)](https://badges.pufler.dev)

Expand Down
27 changes: 2 additions & 25 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,8 @@ inputs:
required: false
default: "False"
runs:
using: composite
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Update Steam Stats in README
run: python api/main.py
shell: bash
env:
STEAM_API_KEY: ${{ inputs.steam_api_key }}
STEAM_ID: ${{ inputs.steam_id }}
STEAM_CUSTOM_ID: ${{ inputs.steam_custom_id }}
WORKSHOP_STATS: ${{ inputs.workshop_stats }}
LOG_SCALE: ${{ inputs.log_scale }}
using: docker
image: Dockerfile
branding:
icon: bar-chart-2
color: blue
3 changes: 3 additions & 0 deletions api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
WORKSHOP_STATS = os.getenv("INPUT_WORKSHOP_STATS", "false").lower() == "true"
LOG_SCALE = os.getenv("INPUT_LOG_SCALE", "false").lower() == "true"

# Version Identifier for Changelog
__version__ = "0.1.0"


def update_readme(markdown_data, start_marker, end_marker, readme_path="README.md"):
"""Updates the README.md file with the provided Markdown content within specified markers"""
Expand Down
Binary file added pyproject.toml
Binary file not shown.
Binary file modified requirements.txt
Binary file not shown.

1 comment on commit 4eb4ac9

@vercel
Copy link

@vercel vercel bot commented on 4eb4ac9 Jun 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.