Skip to content
This repository has been archived by the owner on Oct 13, 2024. It is now read-only.

ci: use rolling releases #192

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 36 additions & 21 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI

on:
pull_request:
branches: [master, nightly]
branches: [master]
types: [opened, synchronize, reopened]
push:
branches: [master]
Expand All @@ -14,28 +14,39 @@ concurrency:
cancel-in-progress: true

jobs:
check_changelog:
name: Check Changelog
setup_release:
name: Setup Release
outputs:
changelog_changes: ${{ steps.setup_release.outputs.changelog_changes }}
changelog_date: ${{ steps.setup_release.outputs.changelog_date }}
changelog_exists: ${{ steps.setup_release.outputs.changelog_exists }}
changelog_release_exists: ${{ steps.setup_release.outputs.changelog_release_exists }}
changelog_url: ${{ steps.setup_release.outputs.changelog_url }}
changelog_version: ${{ steps.setup_release.outputs.changelog_version }}
publish_pre_release: ${{ steps.setup_release.outputs.publish_pre_release }}
publish_release: ${{ steps.setup_release.outputs.publish_release }}
publish_stable_release: ${{ steps.setup_release.outputs.publish_stable_release }}
release_body: ${{ steps.setup_release.outputs.release_body }}
release_build: ${{ steps.setup_release.outputs.release_build }}
release_commit: ${{ steps.setup_release.outputs.release_commit }}
release_generate_release_notes: ${{ steps.setup_release.outputs.release_generate_release_notes }}
release_tag: ${{ steps.setup_release.outputs.release_tag }}
release_version: ${{ steps.setup_release.outputs.release_version }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Verify Changelog
id: verify_changelog
if: ${{ github.ref == 'refs/heads/master' || github.base_ref == 'master' }}
# base_ref for pull request check, ref for push
uses: LizardByte/.github/actions/verify_changelog@master
- name: Setup Release
id: setup_release
uses: LizardByte/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
outputs:
next_version: ${{ steps.verify_changelog.outputs.changelog_parser_version }}
last_version: ${{ steps.verify_changelog.outputs.latest_release_tag_name }}
release_body: ${{ steps.verify_changelog.outputs.changelog_parser_description }}
github_token: ${{ secrets.GITHUB_TOKEN }}

build:
needs:
- setup_release
runs-on: ubuntu-20.04
needs: check_changelog

steps:
- name: Checkout
Expand Down Expand Up @@ -80,7 +91,7 @@ jobs:
shell: bash
working-directory: Themerr-plex.bundle
env:
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version }}
BUILD_VERSION: ${{ needs.setup_release.outputs.release_tag }}
run: |
python ./scripts/build_plist.py
Expand Down Expand Up @@ -115,14 +126,18 @@ jobs:
path: |
${{ github.workspace }}/artifacts
- name: Create Release
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: LizardByte/.github/actions/create_release@master
- name: Create/Update GitHub Release
if: ${{ needs.setup_release.outputs.publish_release == 'true' }}
uses: LizardByte/[email protected]
with:
allowUpdates: true
body: ''
discussionCategory: announcements
generateReleaseNotes: true
name: ${{ needs.setup_release.outputs.release_tag }}
prerelease: ${{ needs.setup_release.outputs.publish_pre_release }}
tag: ${{ needs.setup_release.outputs.release_tag }}
token: ${{ secrets.GH_BOT_TOKEN }}
next_version: ${{ needs.check_changelog.outputs.next_version }}
last_version: ${{ needs.check_changelog.outputs.last_version }}
release_body: ${{ needs.check_changelog.outputs.release_body }}

pytest:
needs: [build]
Expand Down
142 changes: 47 additions & 95 deletions .github/workflows/ci-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,78 +78,37 @@ jobs:
dockerfiles: ${{ steps.find.outputs.dockerfiles }}
matrix: ${{ steps.find.outputs.matrix }}

check_changelog:
name: Check Changelog
needs: [check_dockerfiles]
setup_release:
if: ${{ needs.check_dockerfiles.outputs.dockerfiles }}
name: Setup Release
needs:
- check_dockerfiles
outputs:
changelog_changes: ${{ steps.setup_release.outputs.changelog_changes }}
changelog_date: ${{ steps.setup_release.outputs.changelog_date }}
changelog_exists: ${{ steps.setup_release.outputs.changelog_exists }}
changelog_release_exists: ${{ steps.setup_release.outputs.changelog_release_exists }}
changelog_url: ${{ steps.setup_release.outputs.changelog_url }}
changelog_version: ${{ steps.setup_release.outputs.changelog_version }}
publish_pre_release: ${{ steps.setup_release.outputs.publish_pre_release }}
publish_release: ${{ steps.setup_release.outputs.publish_release }}
publish_stable_release: ${{ steps.setup_release.outputs.publish_stable_release }}
release_body: ${{ steps.setup_release.outputs.release_body }}
release_build: ${{ steps.setup_release.outputs.release_build }}
release_commit: ${{ steps.setup_release.outputs.release_commit }}
release_generate_release_notes: ${{ steps.setup_release.outputs.release_generate_release_notes }}
release_tag: ${{ steps.setup_release.outputs.release_tag }}
release_version: ${{ steps.setup_release.outputs.release_version }}
runs-on: ubuntu-latest
steps:
- name: Checkout
if: ${{ github.ref == 'refs/heads/master' || github.base_ref == 'master' }}
uses: actions/checkout@v4

- name: Verify Changelog
id: verify_changelog
if: ${{ github.ref == 'refs/heads/master' || github.base_ref == 'master' }}
# base_ref for pull request check, ref for push
uses: LizardByte/.github/actions/verify_changelog@master
- name: Setup Release
id: setup_release
uses: LizardByte/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
outputs:
next_version: ${{ steps.verify_changelog.outputs.changelog_parser_version }}
next_version_bare: ${{ steps.verify_changelog.outputs.changelog_parser_version_bare }}
last_version: ${{ steps.verify_changelog.outputs.latest_release_tag_name }}
release_body: ${{ steps.verify_changelog.outputs.changelog_parser_description }}

setup_release:
name: Setup Release
needs: check_changelog
runs-on: ubuntu-latest
steps:
- name: Set release details
id: release_details
env:
RELEASE_BODY: ${{ needs.check_changelog.outputs.release_body }}
run: |
# determine to create a release or not
if [[ $GITHUB_EVENT_NAME == "push" ]]; then
RELEASE=true
else
RELEASE=false
fi
# set the release tag
COMMIT=${{ github.sha }}
if [[ $GITHUB_REF == refs/heads/master ]]; then
TAG="${{ needs.check_changelog.outputs.next_version }}"
RELEASE_NAME="${{ needs.check_changelog.outputs.next_version }}"
RELEASE_BODY="$RELEASE_BODY"
PRE_RELEASE="false"
elif [[ $GITHUB_REF == refs/heads/nightly ]]; then
TAG="nightly-dev"
RELEASE_NAME="nightly"
RELEASE_BODY="automated nightly release - $(date -u +'%Y-%m-%dT%H:%M:%SZ') - ${COMMIT}"
PRE_RELEASE="true"
fi
echo "create_release=${RELEASE}" >> $GITHUB_OUTPUT
echo "release_tag=${TAG}" >> $GITHUB_OUTPUT
echo "release_commit=${COMMIT}" >> $GITHUB_OUTPUT
echo "release_name=${RELEASE_NAME}" >> $GITHUB_OUTPUT
echo "pre_release=${PRE_RELEASE}" >> $GITHUB_OUTPUT
# this is stupid but works for multiline strings
echo "RELEASE_BODY<<EOF" >> $GITHUB_ENV
echo "$RELEASE_BODY" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
outputs:
create_release: ${{ steps.release_details.outputs.create_release }}
release_tag: ${{ steps.release_details.outputs.release_tag }}
release_commit: ${{ steps.release_details.outputs.release_commit }}
release_name: ${{ steps.release_details.outputs.release_name }}
release_body: ${{ env.RELEASE_BODY }}
pre_release: ${{ steps.release_details.outputs.pre_release }}
github_token: ${{ secrets.GITHUB_TOKEN }}

lint_dockerfile:
needs: [check_dockerfiles]
Expand Down Expand Up @@ -180,7 +139,7 @@ jobs:
cat "./hadolint.log" >> $GITHUB_STEP_SUMMARY
docker:
needs: [check_dockerfiles, check_changelog, setup_release]
needs: [check_dockerfiles, setup_release]
if: ${{ needs.check_dockerfiles.outputs.dockerfiles }}
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -210,24 +169,20 @@ jobs:
- name: Prepare
id: prepare
env:
NV: ${{ needs.check_changelog.outputs.next_version }}
NV: ${{ needs.setup_release.outputs.release_tag }}
run: |
# get branch name
BRANCH=${GITHUB_HEAD_REF}
RELEASE=false
RELEASE=${{ needs.setup_release.outputs.publish_release }}
COMMIT=${{ needs.setup_release.outputs.release_commit }}
if [ -z "$BRANCH" ]; then
echo "This is a PUSH event"
BRANCH=${{ github.ref_name }}
COMMIT=${{ github.sha }}
CLONE_URL=${{ github.event.repository.clone_url }}
if [[ $BRANCH == "master" ]]; then
RELEASE=true
fi
else
echo "This is a PULL REQUEST event"
COMMIT=${{ github.event.pull_request.head.sha }}
CLONE_URL=${{ github.event.pull_request.head.repo.clone_url }}
fi
Expand Down Expand Up @@ -260,7 +215,7 @@ jobs:
# parse custom directives out of dockerfile
# try to get the platforms from the dockerfile custom directive, i.e. `# platforms: xxx,yyy`
# directives for PR event, i.e. not push event
if [[ ${PUSH} == "false" ]]; then
if [[ ${RELEASE} == "false" ]]; then
while read -r line; do
if [[ $line == "# platforms_pr: "* && $PLATFORMS == "" ]]; then
# echo the line and use `sed` to remove the custom directive
Expand Down Expand Up @@ -299,13 +254,10 @@ jobs:
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
echo "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
echo "commit=${COMMIT}" >> $GITHUB_OUTPUT
echo "clone_url=${CLONE_URL}" >> $GITHUB_OUTPUT
echo "release=${RELEASE}" >> $GITHUB_OUTPUT
echo "artifacts=${ARTIFACTS}" >> $GITHUB_OUTPUT
echo "no_cache_filters=${NO_CACHE_FILTERS}" >> $GITHUB_OUTPUT
echo "platforms=${PLATFORMS}" >> $GITHUB_OUTPUT
echo "push=${PUSH}" >> $GITHUB_OUTPUT
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
- name: Set Up QEMU
Expand All @@ -324,14 +276,14 @@ jobs:
Docker-buildx${{ matrix.tag }}-
- name: Log in to Docker Hub
if: ${{ steps.prepare.outputs.push == 'true' }} # PRs do not have access to secrets
if: ${{ needs.setup_release.outputs.publish_release == 'true' }} # PRs do not have access to secrets
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Log in to the Container registry
if: ${{ steps.prepare.outputs.push == 'true' }} # PRs do not have access to secrets
if: ${{ needs.setup_release.outputs.publish_release == 'true' }} # PRs do not have access to secrets
uses: docker/login-action@v3
with:
registry: ghcr.io
Expand All @@ -352,10 +304,10 @@ jobs:
build-args: |
BRANCH=${{ steps.prepare.outputs.branch }}
BUILD_DATE=${{ steps.prepare.outputs.build_date }}
BUILD_VERSION=${{ needs.check_changelog.outputs.next_version }}
COMMIT=${{ steps.prepare.outputs.commit }}
BUILD_VERSION=${{ needs.setup_release.outputs.release_tag }}
COMMIT=${{ needs.setup_release.outputs.release_commit }}
CLONE_URL=${{ steps.prepare.outputs.clone_url }}
RELEASE=${{ steps.prepare.outputs.release }}
RELEASE=${{ needs.setup_release.outputs.publish_release }}
tags: ${{ steps.prepare.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
Expand All @@ -367,15 +319,15 @@ jobs:
with:
context: ./
file: ${{ matrix.dockerfile }}
push: ${{ steps.prepare.outputs.push }}
push: ${{ needs.setup_release.outputs.publish_release }}
platforms: ${{ steps.prepare.outputs.platforms }}
build-args: |
BRANCH=${{ steps.prepare.outputs.branch }}
BUILD_DATE=${{ steps.prepare.outputs.build_date }}
BUILD_VERSION=${{ needs.check_changelog.outputs.next_version }}
COMMIT=${{ steps.prepare.outputs.commit }}
BUILD_VERSION=${{ needs.setup_release.outputs.release_tag }}
COMMIT=${{ needs.setup_release.outputs.release_commit }}
CLONE_URL=${{ steps.prepare.outputs.clone_url }}
RELEASE=${{ steps.prepare.outputs.release }}
RELEASE=${{ needs.setup_release.outputs.publish_release }}
tags: ${{ steps.prepare.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
Expand All @@ -401,18 +353,18 @@ jobs:
path: artifacts/

- name: Create/Update GitHub Release
if: ${{ needs.setup_release.outputs.create_release == 'true' && steps.prepare.outputs.artifacts == 'true' }}
uses: ncipollo/release-action@v1
if: ${{ needs.setup_release.outputs.publish_release == 'true' && steps.prepare.outputs.artifacts == 'true' }}
uses: LizardByte/create-release-action@v2023.1128.2625
with:
name: ${{ needs.setup_release.outputs.release_name }}
tag: ${{ needs.setup_release.outputs.release_tag }}
commit: ${{ needs.setup_release.outputs.release_commit }}
artifacts: "*artifacts/*"
token: ${{ secrets.GH_BOT_TOKEN }}
allowUpdates: true
body: ${{ needs.setup_release.outputs.release_body }}
artifacts: "*artifacts/*"
body: ''
discussionCategory: announcements
prerelease: ${{ needs.setup_release.outputs.pre_release }}
generateReleaseNotes: true
name: ${{ needs.setup_release.outputs.release_tag }}
prerelease: ${{ needs.setup_release.outputs.publish_pre_release }}
tag: ${{ needs.setup_release.outputs.release_tag }}
token: ${{ secrets.GH_BOT_TOKEN }}

- name: Update Docker Hub Description
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/localize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: localize

on:
push:
branches: [nightly]
branches: [master]
paths: # prevents workflow from running unless these files change
- '.github/workflows/localize.yml'
- 'Contents/Strings/Themerr-plex.po'
Expand All @@ -21,7 +21,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up Python
uses: LizardByte/action-setup-python@master
uses: LizardByte/setup-python[email protected]
with:
python-version: '2.7'

Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
commit-message: New localization template
branch: localize/update
delete-branch: true
base: nightly
base: master
title: New Babel Updates
body: |
Update report
Expand Down
Loading
Loading