Content-Length: 497473 | pFad | http://github.com/lingodotdev/lingo.dev/commit/957522dd050fccebd05d2adb064d8a6b48a0ebf7

EF feat(action): run on Github without Docker · lingodotdev/lingo.dev@957522d · GitHub
Skip to content

Commit 957522d

Browse files
committed
feat(action): run on Github without Docker
Commit built action into repo and run built JS in GHA.
1 parent 9e16e4d commit 957522d

File tree

7 files changed

+550
-49
lines changed

7 files changed

+550
-49
lines changed

.github/workflows/build-action.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Build Action
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- action/**
8+
- action.yml
9+
branches:
10+
- main
11+
- gha
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
- name: Use Node.js
22+
uses: actions/setup-node@v2
23+
with:
24+
node-version: 18.20.4
25+
- name: Install pnpm
26+
uses: pnpm/action-setup@v4
27+
id: pnpm-install
28+
with:
29+
version: 9.12.3
30+
run_install: true
31+
- name: Build Action
32+
working-directory: ./action
33+
run: pnpm build
34+
- name: Install prod dependencies
35+
working-directory: ./action
36+
run: pnpm install --prod --force --ignore-script
37+
- name: Copy linked dependencies
38+
working-directory: ./action
39+
run: |
40+
find ./node_modules -type l -exec readlink -f {} ';' -exec rm -rf {} ';' | xargs -I % sh -c 'cp -r % ./tmp' && mv ./tmp/* ./node_modules/
41+
- name: Commit built artefacts and dependencies
42+
uses: EndBug/add-and-commit@v9
43+
with:
44+
add: "-f ./action/build ./action/node_modules"
45+
message: "fix(action): build gha [skip ci]"
46+
commit: --no-verify
47+
docker:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Checkout
51+
uses: actions/checkout@v4
52+
- name: Login to Docker Hub
53+
uses: docker/login-action@v3
54+
with:
55+
username: ${{ secrets.DOCKERHUB_LINGODOTDEV_USERNAME }}
56+
password: ${{ secrets.DOCKERHUB_LINGODOTDEV_PASSWORD }}
57+
- name: Set up QEMU
58+
uses: docker/setup-qemu-action@v3
59+
- name: Set up Docker Buildx
60+
uses: docker/setup-buildx-action@v3
61+
- name: Build Docker image and push
62+
uses: docker/build-push-action@v6
63+
with:
64+
push: true
65+
platforms: linux/amd64
66+
context: ./action
67+
file: ./action/Dockerfile
68+
tags: ${{ secrets.DOCKERHUB_LINGODOTDEV_USERNAME }}/ci-action:latest

.github/workflows/docker.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

action.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,9 @@ branding:
77
color: "black"
88

99
runs:
10-
using: "docker"
11-
image: "action/Dockerfile"
12-
env:
13-
LINGODOTDEV_API_KEY: ${{ inputs.api-key }}
14-
LINGODOTDEV_PULL_REQUEST: ${{ inputs.pull-request }}
15-
LINGODOTDEV_COMMIT_MESSAGE: ${{ inputs.commit-message }}
16-
LINGODOTDEV_PULL_REQUEST_TITLE: ${{ inputs.pull-request-title }}
17-
LINGODOTDEV_WORKING_DIRECTORY: ${{ inputs.working-directory }}
18-
LINGODOTDEV_PROCESS_OWN_COMMITS: ${{ inputs.process-own-commits }}
10+
using: "node20"
11+
main: "action/build/index.js"
12+
1913
inputs:
2014
api-key:
2115
description: "Lingo.dev Platform API Key"

action/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"build": "tsc"
55
},
66
"dependencies": {
7+
"@actions/core": "^1.11.1",
78
"@gitbeaker/rest": "^39.34.3",
89
"bitbucket": "^2.12.0",
910
"octokit": "^4.0.2",

action/src/platforms/github.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import core from "@actions/core";
12
import { Octokit } from "octokit";
23
import { PlatformKit } from "./_base.js";
34
import Z from "zod";
@@ -6,6 +7,17 @@ import { execSync } from "child_process";
67
export class GitHubPlatformKit extends PlatformKit {
78
private _octokit?: Octokit;
89

10+
constructor() {
11+
process.env.LINGODOTDEV_API_KEY = core.getInput("api-key");
12+
process.env.LINGODOTDEV_PULL_REQUEST = core.getInput("pull-request");
13+
process.env.LINGODOTDEV_COMMIT_MESSAGE = core.getInput("commit-message");
14+
process.env.LINGODOTDEV_PULL_REQUEST_TITLE = core.getInput("pull-request-title");
15+
process.env.LINGODOTDEV_WORKING_DIRECTORY = core.getInput("working-directory");
16+
process.env.LINGODOTDEV_PROCESS_OWN_COMMITS = core.getInput("process-own-commits");
17+
18+
super();
19+
}
20+
921
get octokit() {
1022
if (!this._octokit) {
1123
this._octokit = new Octokit({ auth: this.platformConfig.ghToken });

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/lingodotdev/lingo.dev/commit/957522dd050fccebd05d2adb064d8a6b48a0ebf7

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy