Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re committed Aug 7, 2022
0 parents commit eb924df
Show file tree
Hide file tree
Showing 6 changed files with 224 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"
template: |
# Changelog
$CHANGES
See details of [all code changes](https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION) since previous release.
categories:
- title: "🚀 Features"
labels:
- "feature"
- "enhancement"
- title: "🐛 Bug Fixes"
labels:
- "fix"
- "bugfix"
- "bug"
- title: "🧰 Maintenance"
labels:
- "infrastructure"
- "automation"
- "documentation"
- title: "🏎 Performance"
label: "performance"
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
version-resolver:
major:
labels:
- "type: breaking"
minor:
labels:
- "type: enhancement"
patch:
labels:
- "type: bug"
- "type: maintenance"
- "type: documentation"
default: patch
14 changes: 14 additions & 0 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Draft release
on:
push:
branches:
- main

jobs:
draft-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release
on:
release:
types: [edited]
workflow_dispatch:
inputs:
TAG_NAME:
description: "Tag name that the major tag will point to"
required: true

env:
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}

permissions:
contents: write

jobs:
update_tag:
name: Update the major tag to include the ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} changes
runs-on: ubuntu-latest
environment:
# Note: this environment is protected
name: Release
steps:
- name: Update the ${{ env.TAG_NAME }} tag
id: update-major-tag
uses: actions/[email protected]
with:
source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
47 changes: 47 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
MIT License Copyright (c) 2022 The Astro Technology Company

Permission is hereby granted, free of
charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the
following conditions:

The above copyright notice and this permission notice
(including the next paragraph) shall be included in all copies or substantial
portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

---

Portions of this code adapted from https://github.com/actions/upload-pages-artifact

MIT License

Copyright (c) 2022 GitHub, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Astro Deploy Action

This action for [Astro](https://github.com/withastro/astro) builds your Astro project for [GitHub Pages](https://pages.github.com/).

## Usage

### Inputs

- `path` - The root location of your Astro project inside the repository. Defaults to `/`.
- `node-version` - The specific version of Node that should be used to build your site. Defaults to `16`.
- `package-manager` - The Node package manager that should be used to install dependencies and build your site. Defaults to `npm`.

### Example workflow:

#### Build and Deploy to GitHub Pages

Create a file at `.github/workflows/deploy.yml` with the following content.

```yml
name: Deploy

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: withastro/action@v0

deploy:
needs: build
runs-on: ubuntu-latest
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
```
41 changes: 41 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "Astro Deploy"
description: "A composite action that prepares your Astro site to be deployed to GitHub Pages"
inputs:
path:
description: "Path of the directory containing your site"
required: true
default: ""
node-version:
description: "The node version to use"
required: true
default: "16"
package-manager:
description: "The package manager that installs, builds and deploys"
required: true
default: "npm"

runs:
using: composite
steps:
- name: Setup PNPM
if: ${{ inputs.package-manager == 'pnpm' }}
uses: pnpm/[email protected]

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
cache: ${{ inputs.package-manager }}

- name: Install
shell: "bash"
run: ${{ inputs.package-manager }} install

- name: Build
shell: "bash"
run: ${{ inputs.package-manager }} run build

- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v1
with:
path: "${{ inputs.path }}dist/"

0 comments on commit eb924df

Please sign in to comment.