Skip to content

Commit

Permalink
chore: create ci
Browse files Browse the repository at this point in the history
  • Loading branch information
maltoze committed Apr 11, 2023
1 parent 344e591 commit 7cb9225
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 3 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Release

on:
push:
tags: [ v\d+\.\d+\.\d+ ]

jobs:
create-release:
permissions:
contents: write
runs-on: ubuntu-20.04
outputs:
release_id: ${{ steps.create-release.outputs.id }}
release_upload_url: ${{ steps.create-release.outputs.upload_url }}

steps:
- uses: actions/checkout@v3

- name: Get version
id: get_version
uses: battila7/get-version-action@v2

- name: Get tag message
id: tag
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
echo "message<<EOF" >> $GITHUB_OUTPUT
echo "$(git tag -l --format='%(contents)' ${{ steps.get_version.outputs.version }})" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release
id: create-release
uses: ncipollo/release-action@v1
with:
draft: true
name: ${{ steps.get_version.outputs.version }}
tag: ${{ steps.get_version.outputs.version }}
body: "${{ steps.tag.outputs.message }}"

build-browser-extension:
runs-on: ubuntu-22.04
needs: create-release

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Get version
id: get_version
uses: battila7/get-version-action@v2

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Build
run: make build
env:
VERSION: "${{ steps.get_version.outputs.version-without-v }}"

- name: Package plugin and create userscript
run: |
mkdir release
mv build/chromium release/link-popper-chrome-extension-${{ steps.get_version.outputs.version-without-v }}
cd release
zip -r link-popper-chrome-extension-${{ steps.get_version.outputs.version-without-v }}.zip ./link-popper-chrome-extension-${{ steps.get_version.outputs.version-without-v }}/*
- name: Upload extensions to release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.release_upload_url }}
asset_path: release/link-popper-chrome-extension-${{ steps.get_version.outputs.version-without-v }}.zip
asset_name: link-popper-chrome-extension-${{ steps.get_version.outputs.version-without-v }}.zip
asset_content_type: application/zip
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
VERSION ?= 0.1.0

change-version:
sed -i -e "s/\"version\": \".*\"/\"version\": \"$(VERSION)\"/" src/manifest.json
sed -i -e "s/\"version\": \".*\"/\"version\": \"$(VERSION)\"/" src/manifest.v2.json
sed -i -e "s/\"version\": \".*\"/\"version\": \"$(VERSION)\"/" package.json

build: change-version
node build.mjs
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "linkpopper",
"version": "1.0.0",
"version": "0.1.0",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "Link Popper",
"version": "1.1.2",
"version": "0.1.0",
"description": "A browser extension that lets you browse linked pages without leaving the current one.",
"icons": {
"16": "logo.png",
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.v2.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Link Popper",
"version": "1.1.2",
"version": "0.1.0",
"description": "A browser extension that lets you browse linked pages without leaving the current one.",
"icons": {
"16": "logo.png",
Expand Down

0 comments on commit 7cb9225

Please sign in to comment.