Add MECCA #5743
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Repository builds and tests | |
on: [ push, pull_request ] | |
jobs: | |
tests: | |
name: Tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
ruby-version: '3.0' | |
env: | |
BUNDLE_WITH: 'tests' | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
/tmp/iso-*.txt | |
/tmp/similarweb | |
key: tmp-files-${{ hashFiles('/tmp/similarweb/*')}} | |
- name: Validate JSON structure | |
run: bundle exec ruby ./tests/validate-json.rb | |
- name: Validate Categories | |
run: bundle exec ruby ./tests/validate-categories.rb | |
- name: Validate Region codes | |
run: bundle exec ruby ./tests/region-codes.rb | |
- name: Validate Language codes | |
run: bundle exec ruby ./tests/language-codes.rb | |
- name: Validate file extensions and permissions | |
run: tests/validate-fs.sh | |
- name: Validate Images | |
run: bundle exec ruby ./tests/validate-images.rb | |
- name: Validate SVG | |
run: bundle exec ruby ./tests/svg-lint.rb | |
- name: Validate URL/Domain reachability | |
run: bundle exec ruby ./tests/validate-urls.rb | |
continue-on-error: true | |
- name: Quality Checks | |
run: bundle exec ruby ./tests/quality-checks.rb | |
- name: Validate Ruby scripts | |
run: bundle exec rubocop | |
publish: | |
name: Build and Publish files | |
if: > | |
github.event_name == 'push' && | |
github.ref == 'refs/heads/master' && | |
github.repository == '2factorauth/twofactorauth' | |
concurrency: | |
group: 'publish' | |
cancel-in-progress: true | |
needs: [ tests ] | |
permissions: | |
pages: write | |
id-token: write | |
environment: production | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
ruby-version: '3.0' | |
- name: Generate API files | |
run: | | |
mkdir -p api/v3 | |
./scripts/APIv3.rb | |
- name: Publish changes to Algolia | |
run: bundle exec ruby ./scripts/Algolia.rb | |
env: | |
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }} | |
ALGOLIA_INDEX_NAME : ${{ vars.ALGOLIA_INDEX_NAME }} | |
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} | |
- uses: crazy-max/ghaction-import-gpg@v5 | |
id: pgp | |
with: | |
gpg_private_key: ${{ secrets.PGP_KEY }} | |
passphrase: ${{ secrets.PGP_PASSWORD }} | |
- name: Sign API files | |
run: bundle exec ruby scripts/Sign.rb | |
env: | |
PGP_PASSWORD: ${{ secrets.PGP_PASSWORD }} | |
PGP_KEY_ID: ${{ steps.pgp.outputs.keyid }} | |
- name: Prepare publish directory | |
run: | | |
mkdir -p public/icons | |
cp -r api/. public/ | |
cp -r img/. public/icons/ | |
cp robots.txt public/ | |
- uses: actions/upload-pages-artifact@v1 | |
with: | |
path: public/ | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v1 | |
- name: Send webhook to Cloudflare | |
run: curl -X POST -IL "${{ secrets.WEBHOOK }}" -o /dev/null -w '%{http_code}\n' -s |