name: Release KoalaSync on: push: tags: - 'v*' jobs: release-server: runs-on: ubuntu-latest permissions: contents: write packages: write steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract Docker metadata id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository }} tags: | type=raw,value=latest type=ref,event=tag - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . file: server/Dockerfile push: true platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} release-extension: runs-on: ubuntu-latest permissions: contents: write steps: - name: Checkout code uses: actions/checkout@v4 - name: Extract version from tag id: version run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT - name: Inject version into source files run: | VERSION=${{ steps.version.outputs.VERSION }} echo "Injecting version $VERSION from tag $GITHUB_REF_NAME..." # 1. extension/manifest.base.json jq --arg v "$VERSION" '.version = $v' extension/manifest.base.json > tmp.json && mv tmp.json extension/manifest.base.json echo " ✓ manifest.base.json -> $VERSION" # 2. shared/constants.js — APP_VERSION sed -i "s/export const APP_VERSION = '.*'/export const APP_VERSION = '$VERSION'/" shared/constants.js echo " ✓ shared/constants.js -> $VERSION" # 3. package.json jq --arg v "$VERSION" '.version = $v' package.json > tmp.json && mv tmp.json package.json echo " ✓ package.json -> $VERSION" echo "Version injection complete." - name: Build Extensions run: | npm install npm run build:extension - name: Create GitHub Release uses: softprops/action-gh-release@v1 with: files: | dist/koalasync-chrome.zip dist/koalasync-firefox.zip name: Release ${{ github.ref_name }} generate_release_notes: true draft: false prerelease: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}