An action to deploy a previously zipped static site to the tangro static file server. The action receives a static site contained in a zip file and automatically deploys the contents under https://$url/$owner/$repo/$step/$context
You can use a specific version
of this action. The latest published version is v1.2.18
. You can also use latest
to always get the latest version.
name: Run CI
on: [push]
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout latest code
uses: actions/checkout@v4
- name: Use Node.js 16.x
uses: actions/[email protected]
with:
node-version: 16.x
- name: Run npm install
run: npm install
- name: Collect Coverage
uses:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_CONTEXT: ${{ toJson(github) }}
- name: Zip coverage results
run: |
cd coverage
cd lcov-report
zip --quiet --recurse-paths ../../coverage.zip *
- name: Deploy coverage
uses: tangro/[email protected]
with:
context: auto
zip-file: coverage.zip
deploy-url: $URL
project: coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_CONTEXT: ${{ toJson(github) }}
DEPLOY_PASSWORD: ${{ secrets.DEPLOY_PASSWORD }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
Attention You have to replace $URL with the deploy URL of your tangro-static file server instance
Steps the action in the example will perform
- Checkout the latest code
- Using node
- Run npm install
- Collect the coverage (using jest)
- Zip the report
- Call the deploy action
You have to have the site you want to deploy ready inside a .zip
. In our example above it was the coverage report created by jest.
The resulting URL will be https://$URL/$owner/$repo/$project/$context
You can have:
- several deploys per project
- several projects per repo
- several repos per owner
- several owners
zip-file
: The name (and the path) of the.zip
file you want to deploy. It's recommended to put the zip file to and serve it from the home directoryproject
: The project/step you want to deploy. To have several static sites per repo. Because the URL structure ishttps://$URL/$owner/$repo/$project/$context
. In our example it is thecoverage
. It could also for example be thestyleguide
or thebuild
(if the built page is a static site)context
: Either'branch'
,'sha'
or'auto'
. When using'branch'
the branch name will be used for the context. When you push into an existing branch the old deploy will be replaced with the new one. When using'sha'
every deploy will be unique since it uses the commitSHA
. By using'auto'
it will deploy a new site when a push is made intodevelop
ormaster
and otherwise will use the branch name. Default is'branch'
set-status
: Set tofalse
to do not set a status to the commit. Defaulttrue
deployed-url
: The URL for the newly deployed site
We need several environment variables to be able to deploy.
GITHUB_TOKEN
To be able to set the statusGITHUB_CONTEXT
DEPLOY_PASSWORD
The password for the/deploy
route on the tangro static serverDEPLOY_USER
The username of the user for the/deploy
route
Follow the guide on the tangro-action-template
repository.