Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring dist back to main #146

Merged
merged 5 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
106 changes: 0 additions & 106 deletions .github/workflows/deploy_branch_github_pages.yml.skip

This file was deleted.

45 changes: 0 additions & 45 deletions .github/workflows/deploy_dist.yml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/ensure_dist_committed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Ensure distribution files committed are up-to-date

on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
ensure_dist_committed:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1

- name: Install Cue
uses: cue-lang/setup-cue@v1.0.0
with:
version: 'v0.7.0'

- name: Install bundler and gems
run: |
gem install bundler
bundle install --jobs 4 --retry 3

- name: Generate distribution files
run: make

- name: Ensure there are no uncommitted distrubtion file changes
id: ensure-dist-committed
run: |
git diff --exit-code || (echo "Please commit the changes made by the build process" && exit 1)

- name: Inform PR author of failure and path to fix
if: ${{ failure() && steps.ensure-dist-committed.outcome == 'failure' }}
run: |
# Comment to send
COMMENT="Hi there! It looks like your pull request changes taxonomy \`data/*\` files, but is missing updates to \`dist/*\` files.<br /><br />**⏭️ How to fix**<br />Make a PR comment of \`/generate_dist\`, and I will fix this for you :robot:. Alternatively, you can run \`make\` locally and commit the changes yourself."

# GitHub API Token and PR URL
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"

# Use jq to encode the JSON properly, carefully handling the new lines and backticks
JSON_BODY=$(jq -n --arg body "$COMMENT" '{body: $body}')

# Use curl to post the comment.
curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST "$COMMENT_URL" -d "$JSON_BODY"
13 changes: 8 additions & 5 deletions .github/workflows/generate_dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request && github.event.comment.body == '/generate_dist' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Checkout PR
run: gh pr checkout $ISSUE
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE: ${{ github.event.issue.html_url }}

- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand All @@ -38,8 +41,8 @@ jobs:

- name: Commit distribution files
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "GitHub Action"
git config --local user.email "action@github.com"
git add dist
git commit -m "🤖 Update distribution files"
git commit -m "🤖 Update distribution files" || exit 0 # Exit gracefully if no changes
git push
1 change: 1 addition & 0 deletions .github/workflows/ci.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
test:
Expand Down
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ schema/mappings_data.cue
.byebug_history

# generated dist files
/dist/*
!/dist/README.md
!/dist/img/
/dist/CHANGELOG.md
21 changes: 0 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ DIST_GENERATED_SENTINEL = tmp/.dist_generated_sentinel
CATEGORIES_JSON = $(GENERATED_DIST_PATH)/categories.json
ATTRIBUTES_JSON = $(GENERATED_DIST_PATH)/attributes.json
MAPPINGS_JSON = $(GENERATED_DIST_PATH)/mappings.json
STATIC_VERSION_FILE = $(GENERATED_DIST_PATH)/VERSION
STATIC_LICENSE_FILE = $(GENERATED_DIST_PATH)/LICENSE
STATIC_CHANGELOG_FILE = $(GENERATED_DIST_PATH)/CHANGELOG.md

# DATA files to run application
LOCAL_DB = tmp/local.sqlite3
Expand All @@ -65,9 +62,6 @@ default: build
.PHONY: default

build: $(DIST_GENERATED_SENTINEL) \
$(STATIC_VERSION_FILE) \
$(STATIC_LICENSE_FILE) \
$(STATIC_CHANGELOG_FILE) \
$(DOCS_GENERATED_SENTINEL) \
$(CATEGORIES_DATA_CUE) \
$(ATTRIBUTES_DATA_CUE) \
Expand All @@ -84,18 +78,6 @@ $(DIST_GENERATED_SENTINEL): $(LOCAL_DB) $(CATEGORIES_DATA) $(ATTRIBUTES_DATA) $(
$(V)bin/generate_dist $(VARG)
$(V)touch $@

$(STATIC_VERSION_FILE):
@$(GENERATE) "Copying Version File" $(STATIC_VERSION_FILE)
$(V)cp -f VERSION $(STATIC_VERSION_FILE)

$(STATIC_LICENSE_FILE):
@$(GENERATE) "Copying License File" $(STATIC_LICENSE_FILE)
$(V)cp -f LICENSE $(STATIC_LICENSE_FILE)

$(STATIC_CHANGELOG_FILE):
@$(GENERATE) "Copying Changelog File" $(STATIC_CHANGELOG_FILE)
$(V)cp -f CHANGELOG.md $(STATIC_CHANGELOG_FILE)

#
# RELEASE
release: build
Expand All @@ -119,9 +101,6 @@ clean:
$(V)rm -f $(MAPPINGS_DATA_CUE)
@$(NUKE) "Cleaning Generated Dist Files" $(GENERATED_DIST_PATH)
$(V)rm -f $(DIST_GENERATED_SENTINEL)
$(V)rm -f $(STATIC_VERSION_FILE)
$(V)rm -f $(STATIC_LICENSE_FILE)
$(V)rm -f $(STATIC_CHANGELOG_FILE)
$(V)rm -rf $(GENERATED_DIST_PATH)/*.json
$(V)rm -rf $(GENERATED_DIST_PATH)/*.txt
.PHONY: clean
Expand Down
Loading
Loading