diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 77090f0a..8becb3ab 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,14 +1,10 @@ -name: Deploy to GitHub Pages +name: Build, update members and deploy on: - # Trigger the workflow every time you push to the `main` branch - # Using a different branch name? Replace `main` with your branch’s name push: branches: [main] - # Allows you to run this workflow manually from the Actions tab on GitHub. workflow_dispatch: -# Allow this job to clone the repo and create a page deployment permissions: contents: read pages: write @@ -18,15 +14,14 @@ jobs: build: runs-on: ubuntu-latest steps: - - name: Checkout your repository using git + - name: Checkout repository uses: actions/checkout@v4 - - name: Install, build, and upload your site + - name: Build website files uses: withastro/action@v2 - # with: - # path: . # The root location of your Astro project inside the repository. (optional) - # node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 20. (optional) - # package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional) - + - name: Update new member files + run: bash ./bin/update-new-members ${{github.event.before}} + - name: Commit member changes, if any + run: bash ./bin/commit-member-changes deploy: needs: build runs-on: ubuntu-latest diff --git a/.github/workflows/update-new-members.yml b/.github/workflows/update-new-members.yml deleted file mode 100644 index db5d0c39..00000000 --- a/.github/workflows/update-new-members.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Update new member files - -on: - pull_request: - branches: - - main - -permissions: - contents: write - id-token: write - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Check out repo - uses: actions/checkout@v4 - - name: Fetch main branch - run: git fetch origin main:main - - name: Install npm packages - run: npm install - - name: Update new member files - run: bash ./bin/update-new-members - - name: Commit member changes, if any - run: bash ./bin/commit-member-changes diff --git a/bin/update-new-members b/bin/update-new-members index b7ac2a71..255eee43 100755 --- a/bin/update-new-members +++ b/bin/update-new-members @@ -1,13 +1,18 @@ #!/bin/bash -eu +# USAGE: ./bin/update-new-members # This script fetches the JSON files specified for all members that have been # added to `members.csv` compared to the `main` branch. Must be run in the # repo's root. +if [ $# -eq 0 ]; then + echo "USAGE: ./bin/update-new-members " +fi + new_member_lines=$( diff \ --changed-group-format='%>' \ --unchanged-group-format='' \ - <( git show main:members.csv ) \ + <( git show $1:members.csv ) \ members.csv ) || true diff --git a/members.csv b/members.csv index 069e494f..0636ba05 100644 --- a/members.csv +++ b/members.csv @@ -1,2 +1,2 @@ sentry,https://raw.githubusercontent.com/opensourcepledge/osspledge.com/main/contrib/example-schema.json -test,https://raw.githubusercontent.com/opensourcepledge/osspledge.com/main/contrib/example-schema.json +newtest,https://raw.githubusercontent.com/opensourcepledge/osspledge.com/main/contrib/example-schema.json