Skip to content

Build and Release

Build and Release #15

Workflow file for this run

name: Build and Release
on:
workflow_dispatch:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# Set up Go
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.23.2'
# Install Go dependencies
- name: Install Go dependencies
run: |
cd rclone-go
go mod tidy
go mod vendor
# Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20.15.0'
# Install Node.js dependencies
- name: Install Node.js dependencies
run: |
cd rclone-web
npm install
# Build the frontend
- name: Build frontend
run: |
cd rclone-web
npm run build
# Build Go backend
- name: Build Go backend
run: |
cd rclone-go
go build -o rclone-backup-app
# Ensure release directory exists
- name: Ensure Release Directory Exists
run: mkdir -p release/myapp
# Package the application (copy frontend, backend, and create a tarball)
- name: Package application
run: |
# Set the version from the Git tag
VERSION=${GITHUB_REF#refs/tags/}
echo "VERSION=$VERSION" >> $GITHUB_ENV
# Ensure directories and files exist
echo "Release directory contents before tar:"
ls -la release
echo "Frontend dist contents:"
ls -la rclone-web/dist
echo "MyApp directory contents:"
ls -la release/myapp
# Copy the frontend and backend files into the release directory
cp -r rclone-web/dist/* release/myapp/
cp rclone-go/rclone-backup-app release/myapp/
# Create a tarball with the proper version
echo "Creating tarball release/rclone-backup-web-${VERSION}.tar.gz"
tar -czvf "release/rclone-backup-web-${VERSION}.tar.gz" -C release myapp
# List current directory (for debugging purposes)
- name: List Current Directory
run: |
echo "Current Directory:"
pwd
echo "Files:"
ls -la
# Upload release assets
- name: Upload release assets
uses: actions/upload-artifact@v3
with:
name: release-assets
path: release/rclone-backup-web-*.tar.gz
# Create GitHub Release
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: release/rclone-backup-web-${{ env.VERSION }}.tar.gz
tag_name: ${{ github.ref }}
token: ${{ secrets.MY_PERSONAL_ACCESS_TOKEN }}