Skip to content

Commit d19a6af

Browse files
authored
Merge pull request #110 from zivoy/save-artifact
Save build artifact for download
2 parents c839418 + ecfde22 commit d19a6af

File tree

2 files changed

+40
-3
lines changed

2 files changed

+40
-3
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
uses: actions/setup-node@v4
2727
with:
2828
node-version: '20'
29+
cache: 'npm' # enable caching for npm
2930

3031
- name: Install dependencies
3132
run: npm ci
@@ -35,12 +36,20 @@ jobs:
3536
run: |
3637
echo "REPO_NAME=$(basename ${{ github.repository }})" >> $GITHUB_ENV
3738
echo "RELEASE_TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
39+
echo "ARTIFACT_SUFFIX=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
3840
3941
- name: Set environment variables (manual)
4042
if: github.event_name == 'workflow_dispatch'
4143
run: |
4244
echo "REPO_NAME=$(basename ${{ github.repository }})" >> $GITHUB_ENV
4345
echo "RELEASE_TAG=${{ github.event.inputs.release_tag }}" >> $GITHUB_ENV
46+
echo "ARTIFACT_SUFFIX=${{ github.event.inputs.release_tag }}" >> $GITHUB_ENV
47+
48+
- name: Set environment variables (push)
49+
if: github.event_name == 'push'
50+
run: |
51+
echo "REPO_NAME=$(basename ${{ github.repository }})" >> $GITHUB_ENV
52+
echo "ARTIFACT_SUFFIX=dev-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
4453
4554
- name: Build extension
4655
run: npm run build
@@ -53,8 +62,22 @@ jobs:
5362
(cd firefox && zip -r ../firefox.zip .)
5463
cd ..
5564
mkdir -p packaged
56-
mv distro/chrome.zip "packaged/${REPO_NAME}-chrome.${RELEASE_TAG}.zip"
57-
mv distro/firefox.zip "packaged/${REPO_NAME}-firefox.${RELEASE_TAG}.zip"
65+
mv distro/chrome.zip "packaged/${REPO_NAME}-chrome.${ARTIFACT_SUFFIX}.zip"
66+
mv distro/firefox.zip "packaged/${REPO_NAME}-firefox.${ARTIFACT_SUFFIX}.zip"
67+
68+
- name: Upload Chrome Artifact
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: ${{ env.REPO_NAME }}-chrome.${{ env.ARTIFACT_SUFFIX }}
72+
path: distro/chrome
73+
retention-days: 90
74+
75+
- name: Upload Firefox Artifact
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: ${{ env.REPO_NAME }}-firefox.${{ env.ARTIFACT_SUFFIX }}
79+
path: distro/firefox
80+
retention-days: 90
5881

5982
- name: Upload zips to release
6083
if: github.event_name == 'release'
@@ -69,7 +92,7 @@ jobs:
6992
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
7093
uses: mnao305/chrome-extension-upload@v5.0.0
7194
with:
72-
file-path: packaged/${{ env.REPO_NAME }}-chrome.${{ env.RELEASE_TAG }}.zip
95+
file-path: packaged/${{ env.REPO_NAME }}-chrome.${{ env.ARTIFACT_SUFFIX }}.zip
7396
extension-id: ${{ secrets.EXTENSION_ID }}
7497
client-id: ${{ secrets.CLIENT_ID }}
7598
client-secret: ${{ secrets.CLIENT_SECRET }}

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,17 @@ You can also download prebuilt versions from the [latest GitHub Release](https:/
135135

136136
1. Download and extract the `.zip` file for your browser.
137137
2. Follow the same steps as **Option 1**, but select the extracted folder instead of `distro/`.
138+
139+
#### Option 3: From GitHub Actions (Latest Development Builds)
140+
141+
To test the absolute latest changes before they are released:
142+
143+
1. Go to the [Actions tab](https://github.com/jacobtender/marian-extension/actions) in the repository.
144+
2. Click on the latest workflow run (usually named "Build and Release").
145+
3. Scroll down to the **Artifacts** section.
146+
4. Download the artifact starting with `marian-extension-chrome.(VERSION)` or `marian-extension-firefox.(VERSION)`.
147+
5. To use either:
148+
- Extract the zip file to a folder and follow **Option 1**, selecting the extracted folder.
149+
- Use directly
150+
- **On Chrome:** Enable Developer mode and drag the zip file onto the window (if you just enabled it refresh first)
151+
- **On Firefox:** Go to Debugging Add-ons ([about:debugging#/runtime/this-firefox](about:debugging#/runtime/this-firefox)) and click Load Temporary Add-on and select the zip file

0 commit comments

Comments
 (0)