Skip to content

Commit 7eedba2

Browse files
committed
ci: Revert using transitdata-shared-workflows
1 parent 1fdc682 commit 7eedba2

File tree

1 file changed

+79
-7
lines changed

1 file changed

+79
-7
lines changed

.github/workflows/ci-cd.yml

Lines changed: 79 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,82 @@ env:
1717

1818
jobs:
1919
build-check-test-push:
20-
uses: HSLdevcom/transitdata-shared-workflows/.github/workflows/ci-cd-typescript.yml@main
21-
secrets:
22-
DOCKER_USERNAME: ${{ secrets.TRANSITDATA_DOCKERHUB_USER }}
23-
DOCKER_PASSWORD: ${{ secrets.TRANSITDATA_DOCKERHUB_TOKEN }}
24-
with:
25-
checkAndTestOutsideDocker: true
26-
codeCoverageEnabled: true
20+
name: Build, check, test, push
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 2
27+
- name: Install Node
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: "lts/*"
31+
cache: "npm"
32+
- name: Install NPM dependencies
33+
run: npm ci
34+
# This step considers also the files ignored in .dockerignore, such as
35+
# documentation and GitHub Actions workflows.
36+
- name: Check and test outside Docker
37+
run: npm run check-and-build
38+
- name: Upload coverage reports to Codecov
39+
uses: codecov/codecov-action@v5
40+
with:
41+
token: ${{ secrets.CODECOV_TOKEN }}
42+
- name: Upload test results to Codecov
43+
if: ${{ !cancelled() }}
44+
uses: codecov/test-results-action@v1
45+
with:
46+
token: ${{ secrets.CODECOV_TOKEN }}
47+
- name: Lowercase Docker image name
48+
run: |
49+
echo "IMAGE_NAME=${IMAGE_NAME_MIXEDCASE,,}" >> "${GITHUB_ENV}"
50+
- name: Docker meta
51+
id: meta
52+
uses: docker/metadata-action@v5
53+
with:
54+
images: ${{ env.IMAGE_NAME }}
55+
tags: |
56+
type=edge,branch=main
57+
type=semver,pattern={{version}}
58+
type=semver,pattern={{major}}.{{minor}}
59+
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
60+
type=sha,format=long
61+
- name: Set up Docker Buildx
62+
uses: docker/setup-buildx-action@v3
63+
- name: Build and export to Docker
64+
uses: docker/build-push-action@v6
65+
with:
66+
context: .
67+
load: true
68+
target: "${{ env.TEST_STAGE }}"
69+
tags: "${{ env.IMAGE_NAME }}:${{ env.TEST_STAGE }}"
70+
- name: Check and test
71+
run: |
72+
docker run --rm "${{ env.IMAGE_NAME }}:${{ env.TEST_STAGE }}"
73+
- name: Check for uncommitted changes
74+
run: |
75+
if [[ -n $(git status --porcelain) ]]; then
76+
echo "::error::Uncommitted changes detected!"
77+
echo "The following files were modified or created:"
78+
git status --porcelain
79+
echo "Please either commit the changes or add them into .gitignore."
80+
exit 1
81+
else
82+
echo "Working directory is clean."
83+
fi
84+
- name: Login to Docker Hub
85+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags/'))
86+
uses: docker/login-action@v3
87+
with:
88+
username: ${{ secrets.TRANSITDATA_DOCKERHUB_USER }}
89+
password: ${{ secrets.TRANSITDATA_DOCKERHUB_TOKEN }}
90+
- name: Build and push
91+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags/'))
92+
uses: docker/build-push-action@v6
93+
with:
94+
context: .
95+
push: true
96+
target: "${{ env.PRODUCTION_STAGE }}"
97+
tags: ${{ steps.meta.outputs.tags }}
98+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)