Skip to content

Commit

Permalink
Update post-to-reddit.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
damongolding committed Sep 12, 2024
1 parent 6f26ba1 commit 7393d96
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions .github/workflows/post-to-reddit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,36 @@ on:
tags:
- "v*"

# jobs:
# post-release-on-reddit:
# runs-on: ubuntu-latest
# steps:
# - name: Extract version from tag
# id: extract_version
# run: |
# VERSION=${GITHUB_REF#refs/tags/}
# echo "VERSION=$VERSION" >> $GITHUB_ENV

# - uses: bluwy/release-for-reddit-action@v2
# with:
# username: ${{ secrets.REDDIT_USERNAME }}
# password: ${{ secrets.REDDIT_PASSWORD }}
# app-id: ${{ secrets.REDDIT_APP_ID }}
# app-secret: ${{ secrets.REDDIT_APP_SECRET }}
# subreddit: immich
# title: Immich Kiosk ${{ env.VERSION }} Released
# # comment: ${{ github.event.release.body }}
# url: https://github.com/damongolding/immich-kiosk/releases/tag/${{ env.VERSION }}

jobs:
post-to-reddit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Get Release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER }}

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install praw
- name: Post to Reddit
env:
REDDIT_CLIENT_ID: ${{ secrets.REDDIT_APP_ID }}
REDDIT_CLIENT_SECRET: ${{ secrets.REDDIT_APP_SECRET }}
REDDIT_USERNAME: ${{ secrets.REDDIT_USERNAME }}
REDDIT_PASSWORD: ${{ secrets.REDDIT_PASSWORD }}
SUBREDDITS: '["immich", "selfhosted"]'
RELEASE_JSON: ${{ toJson(steps.get_release.outputs) }}
run: |
python - <<EOF
import praw
Expand All @@ -61,7 +50,7 @@ jobs:
user_agent="GitHub-Release-Bot/1.0"
)
release = ${{ toJson(github.event.release) }}
release = json.loads(os.environ['RELEASE_JSON'])
title = f"Immich Kiosk {release['tag_name']} Released"
Expand Down

0 comments on commit 7393d96

Please sign in to comment.