-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Allow publishing contents of root directory via ENV.FOLDER
variable
#31
Comments
I was also in need for a feature like this, because Cloudflare Pages needs to receive updates from a non-master branch that must have the same folder structure as the master branch's content. This is my workaround: name: Publish to Pages
on:
push:
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: actions/checkout
uses: actions/[email protected]
- name: Copy content to subdirectory # https://github.com/s0/git-publish-subdir-action/issues/31
run: mkdir /tmp/pages && cp --recursive . /tmp/pages && mv /tmp/pages ./pages
- name: Deploy
uses: s0/[email protected]
env:
REPO: self
BRANCH: pages
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FOLDER: pages |
Nice 👍 I ended up using a similar workaround, except with rsync: ...
- name: Install dependencies
working-directory: ./react
run: npm install
- name: Build app
working-directory: ./react
run: npm run build
- name: Move generated files into ./public
working-directory: ./
run: rsync -avz ./* ./public/ --exclude=node_modules --exclude=.gitignore
- name: List files
working-directory: ./
run: pwd && ls -lha
- name: Push git subdirectory as branch
uses: s0/[email protected]
env:
REPO: self
BRANCH: production
FOLDER: public
SQUASH_HISTORY: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Workaround with rsync works. But I also need to update submodule commit on build branch. Is it possible somehow? |
The
FOLDER
environment variable allows defining a subdirectory whose contents are copied into the destinationBRANCH
, however it does not support copying the entire repo contents into the destination, ie:In fairness, this may be out of scope for this action given that it is called "git-publish-subdir-action" but I found it to be relevant in publishing a wordpress plugin where I need to run webpack in one of the subdirectories and I wanted to keep the generated files out of the main branch, but I also need files in the repo root to be part of the release.
The current workaround is to either fork and update
github-publish-subdir-action
, or to create a preceeding job that:npm run build
in./react
to generate./react/dist/...
mkdir public
in the repo root, andmv
all the files and directories in/
into itThis allows setting
FOLDER
to "public" in order to copy the repo root contents into the destination branch.git-publish-subdir-action/action/src/index.ts
Line 407 in 43ac335
For consideration
Use rsync to copy the folder contents of the source repo to the destination branch root, but exclude the
.git
folder in caseFOLDER
is set to./
The text was updated successfully, but these errors were encountered: