Skip to content

Bump actions/upload-artifact from 3 to 4 #194

Bump actions/upload-artifact from 3 to 4

Bump actions/upload-artifact from 3 to 4 #194

Workflow file for this run

name: tests
on:
push:
branches: [master, main]
tags-ignore: ['**']
paths-ignore: ['**.md']
pull_request:
paths-ignore: ['**.md']
jobs:
gitleaks:
name: Gitleaks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: {fetch-depth: 0}
- name: Check for GitLeaks
uses: gacts/gitleaks@v1 # Action page: <https://github.com/gacts/gitleaks>
eslint:
name: Run eslint
runs-on: ubuntu-latest
env: {FORCE_COLOR: 'true'}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: {node-version: '20'}
- uses: actions/cache@v3
id: yarn-cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --no-progress --non-interactive
- run: yarn lint
dist-built:
name: Check distributive built state
runs-on: ubuntu-latest
outputs:
dist-changed: ${{ steps.state.outputs.changed }}
env: {FORCE_COLOR: 'true'}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: {node-version: '20'}
- uses: actions/cache@v3
id: yarn-cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --no-progress --non-interactive
- run: yarn build
- uses: actions/upload-artifact@v4
with: {name: dist, path: ./dist/, retention-days: 1}
- id: state
run: echo "changed=`git diff --diff-filter=ACMUXTR --name-only | grep dist/ > /dev/null && echo 'true' || echo 'false'`" >> $GITHUB_OUTPUT
commit-and-push-fresh-dist:
name: Commit and push fresh distributive
needs: [dist-built]
if: ${{ needs.dist-built.outputs.dist-changed == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with: {name: dist, path: ./dist/}
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Automatic distributive rebuild
run-this-action:
name: Run action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run this action
uses: ./
id: dev
with:
token: ${{ secrets.DOPPLER_DEV_TOKEN }}
project: ${{ secrets.DOPPLER_PROJECT }}
config: ${{ secrets.DOPPLER_DEV_CONFIG }}
secret-name: DB_URL
- run: if [[ '${{ steps.dev.outputs.secret }}' != 'psql://elon@localhost/modelX' ]]; then exit 1; fi
- name: Run this action with a file
uses: ./
id: production
with:
token: ${{ secrets.DOPPLER_PRODUCTION_TOKEN }}
project: ${{ secrets.DOPPLER_PROJECT }}
config: ${{ secrets.DOPPLER_PRODUCTION_CONFIG }}
secret-name: FEATURE_FLAGS
save-to-file: secret_file
- run: 'echo -ne "{\n\t\"AUTOPILOT\": true,\n\t\"TOP_SPEED\": 130\n}" > ./expected_secret'
- run: cmp -s ./secret_file ./expected_secret || exit 1