Skip to content

Commit

Permalink
chore: update workflow config
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Dec 29, 2024
1 parent 0559bb4 commit 5024dfb
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 73 deletions.
29 changes: 15 additions & 14 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
day: monday
time: "09:00"
commit-message:
prefix: fix
prefix-development: chore
include: scope
labels:
- gha
- dependencies
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
day: monday
time: "14:00"
commit-message:
prefix: ci
prefix-development: ci
include: scope
labels:
- dependencies
- gha
- pinned
26 changes: 0 additions & 26 deletions .github/stale.yml

This file was deleted.

106 changes: 75 additions & 31 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,40 @@
# SPDX-FileCopyrightText: © Vegard IT GmbH (https://vegardit.com) and contributors
# SPDX-FileCopyrightText: © Sebastian Thomschke and contributors
# SPDX-FileContributor: Sebastian Thomschke
# SPDX-License-Identifier: MIT
# SPDX-ArtifactOfProjectHomePage: https://github.com/vegardit/haxe-clink-externs
# SPDX-ArtifactOfProjectHomePage: https://github.com/sebthom/more-clink-completions
#
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: Build

on:
schedule:
- cron: '0 15 1 * *'
push:
branches: # build all branches
- '**'
tags-ignore: # but don't build tags
branches-ignore: # build all branches except:
- 'dependabot/**' # prevent GHA triggered twice (once for commit to the branch and once for opening/syncing the PR)
tags-ignore: # don't build tags
- '**'
paths-ignore:
- '**/*.adoc'
- '**/*.md'
- '.editorconfig'
- '.git*'
- '.github/*.yml'
- '.github/workflows/stale.yml'
- 'tools'
pull_request:
paths-ignore:
- '**/*.adoc'
- '**/*.md'
- '.editorconfig'
- '.git*'
- '.github/*.yml'
- 'tools'
workflow_dispatch:
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
inputs:
debug-with-ssh:
description: "Start an SSH session for debugging purposes after tests ran:"
description: "Start an SSH session for debugging purposes at the end of the build:"
default: never
type: choice
options: [ always, on_failure, on_failure_or_cancelled, never ]
Expand All @@ -37,16 +47,19 @@ on:
default: ".*"
type: string


defaults:
run:
shell: bash

env:
RELEASE_BRANCH: v2

jobs:

###########################################################
build:
###########################################################
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
Expand All @@ -57,32 +70,46 @@ jobs:
- os: ubuntu-latest
haxe: latest
may_create_release: true

steps:
- name: Show environment variables
- name: "Show: GitHub context"
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo $GITHUB_CONTEXT


- name: "Show: environment variables"
run: env | sort


- name: Git Checkout
uses: actions/checkout@v4 #https://github.com/actions/checkout
uses: actions/checkout@v4 # https://github.com/actions/checkout


- name: "Install: Haxe and Haxelibs"
uses: vegardit/haxe-reusable-workflows/.github/actions/setup-haxe@dev
with:
haxe-reusable-workflows-version: dev
haxe-version: ${{ matrix.haxe }}
haxe-libs: no-spoon clink-externs@git:https://github.com/vegardit/haxe-clink-externs
haxe-libs: |
clink-externs@git:https://github.com/vegardit/haxe-clink-externs
no-spoon@git:https://github.com/back2dos/no-spoon
- name: "Run: Haxe compile"
run: |
set -eux
haxe build.hxml
- name: "Install: Lua"
id: setup-haxe-targets
uses: vegardit/haxe-reusable-workflows/.github/actions/setup-haxe-targets@dev
with:
haxe-reusable-workflows-version: dev
setup-lua: 5.2


- name: "Run: Lua minify"
run: |
set -eux
Expand All @@ -98,15 +125,27 @@ jobs:
(echo "$prefix"; cat target/more-clink-completions.lua) > target/more-clink-completions.debug.lua
(echo "$prefix"; cat target/more-clink-completions.packed.lua) > target/more-clink-completions.lua
- name: "Determine release name"
id: release
if: matrix.may_create_release && !env.ACT
run: |
case "$GITHUB_REF_NAME" in
v2)
echo "name=$GITHUB_REF_NAME" >>"$GITHUB_OUTPUT"
echo "branch=${GITHUB_REF_NAME}-releases" >>"$GITHUB_OUTPUT"
;;
esac
- name: Deploy release branch
if: ${{ matrix.may_create_release && github.ref_name == env.RELEASE_BRANCH && !env.ACT }}
if: ${{ steps.release.outputs.name != '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eux
last_commit_message=$(git log --pretty=format:"%s (%h)" -1)
release_branch="${GITHUB_REF_NAME}-releases"
release_branch="{{ steps.release.outputs.branch }}"
github_repo_url="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}"
cd /tmp
Expand Down Expand Up @@ -144,26 +183,29 @@ jobs:
git push origin "$release_branch" --force
fi
- name: "Delete previous 'latest-${{ env.RELEASE_BRANCH }}' release"
if: ${{ matrix.may_create_release && github.ref_name == env.RELEASE_BRANCH && !env.ACT }}
- name: "Delete previous 'latest-${{ steps.release.outputs.name }}' release"
if: ${{ steps.release.outputs.name != '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_NAME: latest-${{ env.RELEASE_BRANCH }}
RELEASE_NAME: ${{ steps.release.outputs.name }}
# https://cli.github.com/manual/gh_release_delete
run: gh release delete "$RELEASE_NAME" --yes --cleanup-tag || true
run: GH_DEBUG=1 gh release delete "$RELEASE_NAME" --yes --cleanup-tag || true


- name: "Create 'latest-${{ env.RELEASE_BRANCH }}' release"
if: ${{ matrix.may_create_release && github.ref_name == env.RELEASE_BRANCH && !env.ACT }}
if: ${{ steps.release.outputs.name != '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_NAME: latest-${{ env.RELEASE_BRANCH }}
RELEASE_NAME: ${{ steps.release.outputs.name }}
COMMIT_MSG: ${{ github.event.head_commit.message }} # https://stackoverflow.com/a/78420438/5116073
# https://cli.github.com/manual/gh_release_create
run: |
gh release create "$RELEASE_NAME" \
GH_DEBUG=1 gh release create "$RELEASE_NAME" \
--title "$RELEASE_NAME" \
--latest \
--prerelease \
--notes "$COMMIT_MSG" \
--target "${{ github.sha }}" \
--notes "$RELEASE_NAME" \
target/more-clink-completions.lua \
target/more-clink-completions.debug.lua
Expand All @@ -174,7 +216,6 @@ jobs:
- name: "SSH session for debugging: check"
id: DEBUG_SSH_SESSSION_CHECK
if: always()
shell: bash
run: |
set -eu
job_filter_pattern="${{ inputs.debug-with-ssh-only-jobs-matching }}"
Expand All @@ -183,16 +224,19 @@ jobs:
job_info=$(echo "$GITHUB_JOB ${{ runner.os }} haxe-${{ matrix.haxe-version }}" | tr -d '\n')
echo "job_info: $job_info"
if [[ "$job_info" =~ .*$job_filter_pattern.* ]] && case "${{ job.status }}" in
success) [[ "${{ inputs.debug-with-ssh }}" == always ]] ;;
cancelled) [[ "${{ inputs.debug-with-ssh }}" == on_failure_or_cancelled ]] ;;
failure) [[ "${{ inputs.debug-with-ssh }}" =~ on_failure.* ]] ;;
when="${{ inputs.debug-with-ssh }}"
if [[ $when == "always" ]] || [[ "$job_info" =~ .*$job_filter_pattern.* ]] && case "${{ job.status }}" in
success) [[ $when == "always" ]] ;;
cancelled) [[ $when == "on_failure_or_cancelled" ]] ;;
failure) [[ $when == "on_failure"* ]] ;;
esac; then
echo "start_session=true" | tee -a "$GITHUB_OUTPUT"
echo "start_ssh_session=true" | tee -a "$GITHUB_OUTPUT"
fi
- name: "SSH session for debugging: start"
uses: mxschmitt/action-tmate@v3 # https://github.com/mxschmitt/action-tmate
if: always() && steps.DEBUG_SSH_SESSSION_CHECK.outputs.start_session
uses: mxschmitt/action-tmate@v3 # https://github.com/mxschmitt/action-tmate
if: always() && steps.DEBUG_SSH_SESSSION_CHECK.outputs.start_ssh_session
with:
limit-access-to-actor: ${{ inputs.debug-with-ssh-only-for-actor }}
54 changes: 54 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: Stale issues

on:
schedule:
- cron: '0 15 1,15 * *'
workflow_dispatch:
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/

permissions:
issues: write
pull-requests: write

jobs:
stale:
runs-on: ubuntu-latest

steps:
- name: Git checkout
uses: actions/checkout@v4 # https://github.com/actions/checkout

- name: Run stale action
uses: actions/stale@v9 # https://github.com/actions/stale
with:
days-before-stale: 90
days-before-close: 14
stale-issue-message: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed in 14 days if no further activity occurs.
If the issue is still valid, please add a respective comment to prevent this
issue from being closed automatically. Thank you for your contributions.
stale-issue-label: stale
close-issue-label: wontfix
exempt-issue-labels: |
enhancement
pinned
security
- name: Run stale action (for enhancements)
uses: actions/stale@v9 # https://github.com/actions/stale
with:
days-before-stale: 360
days-before-close: 14
stale-issue-message: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed in 14 days if no further activity occurs.
If the issue is still valid, please add a respective comment to prevent this
issue from being closed automatically. Thank you for your contributions.
stale-issue-label: stale
close-issue-label: wontfix
only-labels: enhancement
exempt-issue-labels: |
pinned
security
4 changes: 2 additions & 2 deletions haxelib.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"license": "MIT",
"classPath": "src/",
"tags": [
"lua",
"clink"
"clink",
"lua"
],
"description": "Windows command line auto-completion functions for clink.",
"contributors": [
Expand Down

0 comments on commit 5024dfb

Please sign in to comment.