Skip to content

doc(readme): use github selfhost badge #8

doc(readme): use github selfhost badge

doc(readme): use github selfhost badge #8

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
pages: write
id-token: write
env:
REPO_NAME: ghnote
CODENAME: stable
SUITE: stable
COMPONENTS: main
ARCHITECTURES: amd64 arm64
jobs:
build:
runs-on: ubuntu-latest
outputs:
keyring: ${{ steps.create-apt-repo.outputs.keyring }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Goreleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: ~> v2
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create APT repository
id: create-apt-repo
uses: morph027/apt-repo-action@v3
with:
repo-name: ${{ env.REPO_NAME }}
scan-dir: ${{ github.workspace }}/dist
suite: ${{ env.SUITE }}
codename: ${{ env.CODENAME }}
components: ${{ env.COMPONENTS }}
architectures: ${{ env.ARCHITECTURES }}
signing-key: ${{ secrets.APT_SIGNING_KEY }}
signing-key-passphrase: ${{ secrets.APT_SIGNING_KEY_PASSPHRASE }}
import-from-repo-url: |
deb-amd64 https://Peter33333.github.io/github-note/ ${{ env.CODENAME }} ${{ env.COMPONENTS }}
deb-arm64 https://Peter33333.github.io/github-note/ ${{ env.CODENAME }} ${{ env.COMPONENTS }}
import-from-repo-failure-allow: true
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: ${{ steps.create-apt-repo.outputs.dir }}
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Print install commands
run: |
echo '### APT install' >> "$GITHUB_STEP_SUMMARY"
echo '' >> "$GITHUB_STEP_SUMMARY"
echo '```bash' >> "$GITHUB_STEP_SUMMARY"
echo 'curl -fsSL ${{ steps.deployment.outputs.page_url }}gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/${{ needs.build.outputs.keyring }}.gpg' >> "$GITHUB_STEP_SUMMARY"
echo 'echo "deb [signed-by=/usr/share/keyrings/${{ needs.build.outputs.keyring }}.gpg] ${{ steps.deployment.outputs.page_url }} ${{ env.CODENAME }} ${{ env.COMPONENTS }}" | sudo tee /etc/apt/sources.list.d/${{ env.REPO_NAME }}.list' >> "$GITHUB_STEP_SUMMARY"
echo 'sudo apt update && sudo apt install ghnote' >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"