Skip to content

Commit

Permalink
Simplify actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ffried committed Mar 29, 2023
1 parent b624064 commit af8e896
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 106 deletions.
30 changes: 30 additions & 0 deletions .github/actions/generate-action-code/action.yml
@@ -0,0 +1,30 @@
name: Generate Action Code
description: Generates the action code

inputs:
fix-permissions:
description: Fix permissions for npm cache
required: false
default: 'false'

runs:
using: composite
steps:
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
check-latest: true
cache: 'npm'
- name: Fix npm permissions
if: ${{ inputs.fix-permissions == 'true' }}
shell: bash
run: |
if [ -d "${HOME}/.npm" ]; then
sudo chown -R "${USER}:$(id -gn ${USER})" "${HOME}/.npm"
fi
- name: Install dependencies
shell: bash
run: sudo npm i -g typescript @vercel/ncc
- name: Generate action code
shell: bash
run: npm run deploy
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Expand Up @@ -12,6 +12,17 @@ updates:
- ffried
reviewers:
- ffried
- package-ecosystem: "github-actions"
directory: ".github/actions/generate-action-code"
open-pull-requests-limit: 10
schedule:
interval: "daily"
time: "07:00"
timezone: "Europe/Berlin"
assignees:
- ffried
reviewers:
- ffried
- package-ecosystem: "npm"
directory: "/"
open-pull-requests-limit: 10
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/deploy.yml
Expand Up @@ -10,19 +10,10 @@ jobs:
name: Deploy Action Code
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
if: ${{ github.event_name == 'pull_request' }}
with:
node-version: 'lts/*'
check-latest: true
cache: 'npm'
- name: Install dependencies
run: sudo npm i -g typescript @vercel/ncc
- uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_TOKEN }}
- name: Generate action code
run: npm run deploy
- uses: ./.github/actions/generate-action-code
- name: Configure repository
env:
BOT_USERNAME: ${{ secrets.BOT_USERNAME }}
Expand Down
114 changes: 18 additions & 96 deletions .github/workflows/tests.yml
Expand Up @@ -40,25 +40,12 @@ jobs:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ^14.0
- uses: actions/setup-node@v3
if: ${{ github.event_name == 'pull_request' }}
with:
node-version: 'lts/*'
check-latest: true
cache: 'npm'
- name: Fix npm permissions
if: ${{ github.event_name == 'pull_request' }}
run: |
if [ -d "${HOME}/.npm" ]; then
sudo chown -R "${USER}:$(id -gn ${USER})" "${HOME}/.npm"
fi
- name: Install dependencies
if: ${{ github.event_name == 'pull_request' }}
run: sudo npm i -g typescript @vercel/ncc
- uses: actions/checkout@v3
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
run: npm run deploy
uses: ./.github/actions/generate-action-code
with:
fix-permissions: true
- uses: sersoft-gmbh/xcodebuild-action@master
if: ${{ github.event_name == 'push' }}
with:
Expand Down Expand Up @@ -110,25 +97,12 @@ jobs:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ^14.0
- uses: actions/setup-node@v3
if: ${{ github.event_name == 'pull_request' }}
with:
node-version: 'lts/*'
check-latest: true
cache: 'npm'
- name: Fix npm permissions
if: ${{ github.event_name == 'pull_request' }}
run: |
if [ -d "${HOME}/.npm" ]; then
sudo chown -R "${USER}:$(id -gn ${USER})" "${HOME}/.npm"
fi
- name: Install dependencies
if: ${{ github.event_name == 'pull_request' }}
run: sudo npm i -g typescript @vercel/ncc
- uses: actions/checkout@v3
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
run: npm run deploy
uses: ./.github/actions/generate-action-code
with:
fix-permissions: true
- uses: sersoft-gmbh/xcodebuild-action@master
if: ${{ github.event_name == 'push' }}
with:
Expand Down Expand Up @@ -167,25 +141,12 @@ jobs:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ^14.0
- uses: actions/setup-node@v3
if: ${{ github.event_name == 'pull_request' }}
with:
node-version: 'lts/*'
check-latest: true
cache: 'npm'
- name: Fix npm permissions
if: ${{ github.event_name == 'pull_request' }}
run: |
if [ -d "${HOME}/.npm" ]; then
sudo chown -R "${USER}:$(id -gn ${USER})" "${HOME}/.npm"
fi
- name: Install dependencies
if: ${{ github.event_name == 'pull_request' }}
run: sudo npm i -g typescript @vercel/ncc
- uses: actions/checkout@v3
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
run: npm run deploy
uses: ./.github/actions/generate-action-code
with:
fix-permissions: true
- uses: sersoft-gmbh/xcodebuild-action@master
if: ${{ github.event_name == 'push' }}
with:
Expand Down Expand Up @@ -240,25 +201,12 @@ jobs:
env:
DEBUG_ENABLED: ${{ secrets.ACTIONS_STEP_DEBUG }}
run: test "${DEBUG_ENABLED}" == 'true'
- uses: actions/setup-node@v3
if: ${{ github.event_name == 'pull_request' }}
with:
node-version: 'lts/*'
check-latest: true
cache: 'npm'
- name: Fix npm permissions
if: ${{ github.event_name == 'pull_request' }}
run: |
if [ -d "${HOME}/.npm" ]; then
sudo chown -R "${USER}:$(id -gn ${USER})" "${HOME}/.npm"
fi
- name: Install dependencies
if: ${{ github.event_name == 'pull_request' }}
run: sudo npm i -g typescript @vercel/ncc
- uses: actions/checkout@v3
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
run: npm run deploy
uses: ./.github/actions/generate-action-code
with:
fix-permissions: true
- uses: sersoft-gmbh/xcodebuild-action@master
if: ${{ github.event_name == 'push' }}
id: xcodebuild-master
Expand Down Expand Up @@ -432,25 +380,12 @@ jobs:
env:
DEBUG_ENABLED: ${{ secrets.ACTIONS_STEP_DEBUG }}
run: test "${DEBUG_ENABLED}" == 'true'
- uses: actions/setup-node@v3
if: ${{ github.event_name == 'pull_request' }}
with:
node-version: 'lts/*'
check-latest: true
cache: 'npm'
- name: Fix npm permissions
if: ${{ github.event_name == 'pull_request' }}
run: |
if [ -d "${HOME}/.npm" ]; then
sudo chown -R "${USER}:$(id -gn ${USER})" "${HOME}/.npm"
fi
- name: Install dependencies
if: ${{ github.event_name == 'pull_request' }}
run: sudo npm i -g typescript @vercel/ncc
- uses: actions/checkout@v3
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
run: npm run deploy
uses: ./.github/actions/generate-action-code
with:
fix-permissions: true
- uses: sersoft-gmbh/xcodebuild-action@master
if: ${{ github.event_name == 'push' }}
id: xcodebuild-master
Expand Down Expand Up @@ -627,25 +562,12 @@ jobs:
env:
DEBUG_ENABLED: ${{ secrets.ACTIONS_STEP_DEBUG }}
run: test "${DEBUG_ENABLED}" == 'true'
- uses: actions/setup-node@v3
if: ${{ github.event_name == 'pull_request' }}
with:
node-version: 'lts/*'
check-latest: true
cache: 'npm'
- name: Fix npm permissions
if: ${{ github.event_name == 'pull_request' }}
run: |
if [ -d "${HOME}/.npm" ]; then
sudo chown -R "${USER}:$(id -gn ${USER})" "${HOME}/.npm"
fi
- name: Install dependencies
if: ${{ github.event_name == 'pull_request' }}
run: sudo npm i -g typescript @vercel/ncc
- uses: actions/checkout@v3
- name: Generate action code
if: ${{ github.event_name == 'pull_request' }}
run: npm run deploy
uses: ./.github/actions/generate-action-code
with:
fix-permissions: true
- uses: sersoft-gmbh/xcodebuild-action@master
if: ${{ github.event_name == 'push' }}
id: xcodebuild-master
Expand Down

0 comments on commit af8e896

Please sign in to comment.