Skip to content

Commit

Permalink
Merge pull request #64 from LizardByte/nightly
Browse files Browse the repository at this point in the history
v0.0.5
  • Loading branch information
ReenigneArcher authored Jul 31, 2022
2 parents 5cb8935 + 1aa125b commit 024743f
Show file tree
Hide file tree
Showing 21 changed files with 572 additions and 400 deletions.
1 change: 1 addition & 0 deletions .docker_platforms
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
linux/386,linux/amd64,linux/arm64/v8
16 changes: 14 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This action is centrally managed in https://github.com/<organization>/.github/
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in
# the above-mentioned repo.

version: 2
updates:
- package-ecosystem: "github-actions"
Expand All @@ -6,12 +10,20 @@ updates:
interval: "daily"
time: "00:00"
target-branch: "nightly"
open-pull-requests-limit: 20
open-pull-requests-limit: 10

- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
time: "00:00"
target-branch: "nightly"
open-pull-requests-limit: 10

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
time: "00:00"
target-branch: "nightly"
open-pull-requests-limit: 20
open-pull-requests-limit: 10
10 changes: 6 additions & 4 deletions .github/label-actions.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# This action is centrally managed in https://github.com/<organization>/.github/
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in
# the above-mentioned repo.

# Configuration for Label Actions - https://github.com/dessant/label-actions

added:
comment: >
This feature has been added and will be available in the next release.
fixed:
comment: >
This issue has been fixed and will be available in the next release.
invalid:duplicate:
comment: >
:wave: @{issue-author}, this appears to be a duplicate of a pre-existing issue.
Expand All @@ -22,8 +24,8 @@ invalid:duplicate:
invalid:support:
comment: >
:wave: @{issue-author}, we use the issue tracker exclusively for bug reports.
However, this issue appears to be a support request. Please use our
[Discord Server](https://retroarcher.github.io/discord) to get help with RetroArcher. Thanks.
However, this issue appears to be a support request. Please use
[Discord](https://docs.lizardbyte.dev/about/support.html#discord) for support issues. Thanks.
close: true
lock: true
lock-reason: 'off-topic'
Expand Down
24 changes: 24 additions & 0 deletions .github/pr_release_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## Description
<!--- Please include a summary of the changes. --->
This PR was created automatically.


### Screenshot
<!--- Include screenshots if the changes are UI-related. --->


### Issues Fixed or Closed
<!--- Close issue example: `- Closes #1` --->
<!--- Fix bug issue example: `- Fixes #2` --->
<!--- Resolve issue example: `- Resolves #3` --->


## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update (changes to documentation)
- [ ] Repository update (changes to repository files)

## Changelog Summary
<!--- Summarize all the changes in a bulleted list. --->
113 changes: 5 additions & 108 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]
types: [opened, synchronize, edited, reopened]
types: [opened, synchronize, reopened]
push:
branches: [master, nightly]
workflow_dispatch:
Expand All @@ -14,127 +14,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
if: ${{ github.ref == 'refs/heads/master' || github.base_ref == 'master' }}
uses: actions/checkout@v3

- 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: RetroArcher/actions/verify_changelog@master
uses: LizardByte/.github/actions/verify_changelog@master
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 }}

docker:
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
needs: check_changelog

env:
BASE_TAG: retroarcher/discord-bot

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Prepare
id: prepare
env:
NEXT_VERSION: ${{ needs.check_changelog.outputs.next_version }}
run: |
# determine to push image to dockerhub and ghcr or not
if [[ $GITHUB_EVENT_NAME == "push" ]]; then
PUSH=true
else
PUSH=false
fi
# setup the tags
TAGS="${BASE_TAG}:${GITHUB_SHA},ghcr.io/${BASE_TAG}:${GITHUB_SHA}"
if [[ $GITHUB_REF == refs/heads/master ]]; then
TAGS="${TAGS},${BASE_TAG}:latest,ghcr.io/${BASE_TAG}:latest"
TAGS="${TAGS},${BASE_TAG}:master,ghcr.io/${BASE_TAG}:master"
elif [[ $GITHUB_REF == refs/heads/nightly ]]; then
TAGS="${TAGS},${BASE_TAG}:nightly,ghcr.io/${BASE_TAG}:nightly"
else
TAGS="${TAGS},${BASE_TAG}:test,ghcr.io/${BASE_TAG}:test"
fi
if [[ ${NEXT_VERSION} != "" ]]; then
TAGS="${TAGS},${BASE_TAG}:${NEXT_VERSION},ghcr.io/${BASE_TAG}:${NEXT_VERSION}"
fi
echo ::set-output name=branch::${GITHUB_REF#refs/heads/}
echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
echo ::set-output name=commit::${GITHUB_SHA}
echo ::set-output name=platforms::linux/386,linux/amd64,linux/arm64/v8
echo ::set-output name=push::${PUSH}
echo ::set-output name=tags::${TAGS}
- name: Set Up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
id: buildx

- name: Cache Docker Layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Log in to Docker Hub
if: ${{ steps.prepare.outputs.push == 'true' }} # PRs do not have access to secrets
uses: docker/login-action@v1
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
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: ${{ steps.prepare.outputs.push }}
platforms: ${{ steps.prepare.outputs.platforms }}
build-args: |
BRANCH=${{ steps.prepare.outputs.branch }}
COMMIT=${{ steps.prepare.outputs.commit }}
BUILD_DATE=${{ steps.prepare.outputs.build_date }}
tags: ${{ steps.prepare.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

- name: Update Docker Hub Description
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }} # token is not currently supported
repository: ${{ env.BASE_TAG }}
short-description: ${{ github.event.repository.description }}
readme-filepath: ./DOCKER_README.md

create_release:
runs-on: ubuntu-latest
needs: [check_changelog, docker]
needs: [check_changelog]
steps:

- name: Create/Update GitHub Release
Expand All @@ -143,6 +40,6 @@ jobs:
with:
name: ${{ needs.check_changelog.outputs.next_version }}
tag: ${{ needs.check_changelog.outputs.next_version }}
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GH_BOT_TOKEN }}
allowUpdates: true
body: ${{ needs.check_changelog.outputs.release_body }}
33 changes: 33 additions & 0 deletions .github/workflows/auto-create-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This action is centrally managed in https://github.com/<organization>/.github/
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in
# the above-mentioned repo.

name: Auto create PR

on:
pull_request:
types:
- closed
branches:
- 'nightly'

jobs:
create_pr:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Create Pull Request
uses: repo-sync/pull-request@v2
with:
source_branch: "" # should be "nightly" as it's the triggering branch
destination_branch: "master"
pr_title: "Pulling ${{ github.ref }} into master"
pr_template: ".github/pr_release_template.md"
pr_assignee: "${{ secrets.GH_BOT_NAME }}"
pr_draft: true
pr_allow_empty: false
github_token: ${{ secrets.GH_BOT_TOKEN }}
58 changes: 58 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This action is centrally managed in https://github.com/<organization>/.github/
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in
# the above-mentioned repo.

name: Automerge PR

on:
pull_request:
types:
- opened
- synchronize

jobs:
autoapprove:
if: >
contains(fromJson('["LizardByte-bot"]'), github.event.pull_request.user.login) &&
contains(fromJson('["LizardByte-bot"]'), github.actor)
runs-on: ubuntu-latest
steps:
- name: Autoapproving
uses: hmarr/auto-approve-action@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Label autoapproved
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GH_BOT_TOKEN }}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['autoapproved', 'autoupdate']
})
automerge:
needs: [autoapprove]
runs-on: ubuntu-latest
concurrency:
group: automerge-${{ github.ref }}
cancel-in-progress: true

steps:
- name: Automerging
uses: pascalgn/[email protected]
env:
BASE_BRANCHES: nightly
GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
GITHUB_LOGIN: ${{ secrets.GH_BOT_NAME }}
MERGE_LABELS: ""
MERGE_METHOD: "squash"
MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})"
MERGE_DELETE_BRANCH: true
MERGE_ERROR_FAIL: true
MERGE_FILTER_AUTHOR: ${{ secrets.GH_BOT_NAME }}
MERGE_RETRIES: "240" # 1 hour
MERGE_RETRY_SLEEP: "15000" # 15 seconds
Loading

0 comments on commit 024743f

Please sign in to comment.