Merge pull request #35 from The-Nefarious-Developer/fix-sap-login #117
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: Build, Test and Deploy | |
on: | |
push: | |
paths: | |
- 'com.developer.nefarious.zjoule.feature/**' | |
- 'com.developer.nefarious.zjoule.plugin/**' | |
- 'com.developer.nefarious.zjoule.test/**' | |
- 'com.developer.nefarious.zjoule.updatesite/**' | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
cache: maven | |
- name: Build with Maven Wrapper | |
run: ./mvnw clean verify | |
release: | |
needs: test | |
if: "!contains(github.event.head_commit.message, 'skip ci') && github.ref == 'refs/heads/main'" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
cache: maven | |
- name: Setup Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18 | |
- name: Install semantic-release | |
run: | | |
npm install -g semantic-release \ | |
@semantic-release/changelog \ | |
@semantic-release/commit-analyzer \ | |
@semantic-release/exec \ | |
@semantic-release/git \ | |
@semantic-release/release-notes-generator | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.NEFARIOUS_GITHUB_TOKEN }} | |
run: chmod +x ./scripts/prepare-release.sh && npx semantic-release | |
update-website: | |
needs: release | |
if: "!contains(github.event.head_commit.message, 'skip ci') && github.ref == 'refs/heads/main'" | |
runs-on: ubuntu-latest | |
env: | |
GH_TOKEN: ${{ secrets.NEFARIOUS_GITHUB_TOKEN }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Get the latest release tag | |
id: get_release | |
run: | | |
LATEST_TAG=$(gh release view --json tagName -q ".tagName") | |
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV | |
- name: Configure Git | |
run: | | |
git config --global user.name "nefarious-developer-bot" | |
git config --global user.email "nefarious-developer-bot@users.noreply.github.com" | |
- name: Clone the target repository | |
run: | | |
git clone https://nefarious-developer-bot:${GH_TOKEN}@github.com/The-Nefarious-Developer/zjoule-website.git website-repo | |
- name: Create a new branch | |
working-directory: website-repo | |
run: | | |
git checkout -b update-to-$LATEST_TAG | |
- name: Run the script to update the website | |
working-directory: website-repo | |
run: | | |
chmod +x ../scripts/update-website.sh | |
../scripts/update-website.sh $LATEST_TAG | |
- name: Commit the changes | |
working-directory: website-repo | |
run: | | |
git add . | |
git commit -m "feat: update to $LATEST_TAG" | |
- name: Push the changes | |
working-directory: website-repo | |
run: | | |
git push https://nefarious-developer-bot:${GH_TOKEN}@github.com/The-Nefarious-Developer/zjoule-website.git update-to-$LATEST_TAG | |
- name: Create a pull request | |
working-directory: website-repo | |
run: | | |
gh pr create \ | |
--title "Update to $LATEST_TAG" \ | |
--body "This PR updates the website to the latest release $LATEST_TAG." \ | |
--head update-to-$LATEST_TAG \ | |
--base main | |
- name: Automatically merge the pull request | |
working-directory: website-repo | |
run: | | |
PR_URL=$(gh pr view update-to-$LATEST_TAG --json url -q ".url") | |
gh pr merge $PR_URL --squash --admin --delete-branch |