|
40 | 40 | username: ${{ secrets.DOCKERHUB_USERNAME }}
|
41 | 41 | password: ${{ secrets.DOCKERHUB_TOKEN }}
|
42 | 42 |
|
43 |
| - - name: Get previous release tag |
44 |
| - id: prev_release |
45 |
| - uses: actions/github-script@v6 |
46 |
| - with: |
47 |
| - script: | |
48 |
| - const releases = await github.rest.repos.listReleases({ |
49 |
| - owner: context.repo.owner, |
50 |
| - repo: context.repo.repo |
51 |
| - }); |
52 |
| - |
53 |
| - // Find current release in the list |
54 |
| - const currentReleaseTag = context.payload.release.tag_name; |
55 |
| - const currentIndex = releases.data.findIndex(r => r.tag_name === currentReleaseTag); |
56 |
| - |
57 |
| - // Get previous release if it exists |
58 |
| - if (currentIndex >= 0 && releases.data.length > currentIndex + 1) { |
59 |
| - const prevRelease = releases.data[currentIndex + 1]; |
60 |
| - console.log(`Previous release: ${prevRelease.tag_name}`); |
61 |
| - return prevRelease.tag_name; |
62 |
| - } else { |
63 |
| - console.log('No previous release found'); |
64 |
| - return ''; |
65 |
| - } |
66 |
| -
|
67 |
| - - name: Backwards compatibility check |
68 |
| - if: steps.prev_release.outputs.result != '' |
69 |
| - run: | |
70 |
| - # Create directory for database |
71 |
| - mkdir -p ./data |
72 |
| - |
73 |
| - # Pull previous image |
74 |
| - PREV_TAG=${{ steps.prev_release.outputs.result }} |
75 |
| - docker pull ${{ env.DOCKER_IMAGE }}:${PREV_TAG} |
76 |
| - |
77 |
| - # Run migrations on previous version |
78 |
| - echo "Running migrations on previous version ${PREV_TAG}" |
79 |
| - docker run --name prev-revect -v $(pwd)/data:/app/data ${{ env.DOCKER_IMAGE }}:${PREV_TAG} bun run /app/src/database/migrations.ts up |
80 |
| - |
81 |
| - # Build current version for testing (only amd64 for testing) |
82 |
| - docker build -t ${{ env.DOCKER_IMAGE }}:test . |
83 |
| - |
84 |
| - # Test migrations with the new version |
85 |
| - echo "Testing migrations on new version" |
86 |
| - docker run --name new-revect -v $(pwd)/data:/app/data ${{ env.DOCKER_IMAGE }}:test bun run /app/src/database/migrations.ts up |
87 |
| - |
88 |
| - # Cleanup |
89 |
| - docker rm prev-revect new-revect |
90 |
| - rm -rf ./data |
91 |
| -
|
92 | 43 | - name: Extract metadata for Docker
|
93 | 44 | id: meta
|
94 | 45 | uses: docker/metadata-action@v5
|
|
0 commit comments