first commit
This commit is contained in:
66
.github/workflows/docker.yml
vendored
Normal file
66
.github/workflows/docker.yml
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
name: Docker Build and Push
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Build
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=sha
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Build and push test image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile.test
|
||||
push: true
|
||||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:test
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
80
.github/workflows/release.yml
vendored
Normal file
80
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-release:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get version from tag
|
||||
id: get_version
|
||||
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create release tarball
|
||||
run: |
|
||||
mkdir -p dist
|
||||
tar -czf dist/finish-v${{ steps.get_version.outputs.VERSION }}.tar.gz \
|
||||
--exclude='.git' \
|
||||
--exclude='.github' \
|
||||
--exclude='dist' \
|
||||
--exclude='.idea' \
|
||||
--transform "s,^,finish-${{ steps.get_version.outputs.VERSION }}/," \
|
||||
.
|
||||
|
||||
- name: Calculate SHA256
|
||||
id: sha256
|
||||
run: |
|
||||
SHA256=$(sha256sum dist/finish-v${{ steps.get_version.outputs.VERSION }}.tar.gz | awk '{print $1}')
|
||||
echo "SHA256=$SHA256" >> $GITHUB_OUTPUT
|
||||
echo "SHA256: $SHA256"
|
||||
|
||||
- name: Build Debian package
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y debhelper devscripts
|
||||
dpkg-buildpackage -us -uc -b
|
||||
mv ../finish_*.deb dist/ || true
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: |
|
||||
dist/*.tar.gz
|
||||
dist/*.deb
|
||||
body: |
|
||||
## Installation
|
||||
|
||||
### Quick Install (Linux/macOS)
|
||||
```bash
|
||||
curl -sSL https://git.appmodel.nl/Tour/finish/main/docs/install.sh | bash
|
||||
```
|
||||
|
||||
### Homebrew (macOS)
|
||||
Update the formula with SHA256: `${{ steps.sha256.outputs.SHA256 }}`
|
||||
|
||||
### Debian/Ubuntu
|
||||
Download the `.deb` file and install:
|
||||
```bash
|
||||
sudo dpkg -i finish_*.deb
|
||||
sudo apt-get install -f # Install dependencies
|
||||
```
|
||||
|
||||
### Docker
|
||||
```bash
|
||||
docker pull ghcr.io/${{ github.repository }}:${{ steps.get_version.outputs.VERSION }}
|
||||
```
|
||||
|
||||
## Changelog
|
||||
See [CHANGELOG.md](CHANGELOG.md) for details.
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
69
.github/workflows/test.yml
vendored
Normal file
69
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main, develop ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
shell: [bash, zsh]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y bash zsh curl jq bc bash-completion bats
|
||||
|
||||
- name: Make script executable
|
||||
run: chmod +x finishte.sh
|
||||
|
||||
- name: Run BATS tests
|
||||
run: |
|
||||
if [ -d tests ]; then
|
||||
bats tests/
|
||||
else
|
||||
echo "No tests directory found"
|
||||
fi
|
||||
|
||||
- name: Test installation
|
||||
run: |
|
||||
export HOME=$PWD/test-home
|
||||
mkdir -p $HOME/.local/bin
|
||||
cp finishte.sh $HOME/.local/bin/finishte
|
||||
chmod +x $HOME/.local/bin/finishte
|
||||
$HOME/.local/bin/finishte --help
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install shellcheck
|
||||
run: sudo apt-get update && sudo apt-get install -y shellcheck
|
||||
|
||||
- name: Run shellcheck
|
||||
run: shellcheck finishte.sh docs/install.sh || true
|
||||
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build Docker image
|
||||
run: docker build -t finish:test .
|
||||
|
||||
- name: Test Docker image
|
||||
run: |
|
||||
docker run --rm finish:test -c "finishte --help"
|
||||
Reference in New Issue
Block a user