feat: add release workflow #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| lint-workflows: | |
| name: Lint Workflows | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Run actionlint | |
| run: | | |
| bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) | |
| ./actionlint | |
| test-action: | |
| name: Test Action | |
| runs-on: ubuntu-latest | |
| needs: lint-workflows | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Create test script | |
| run: | | |
| mkdir -p .github/scripts | |
| cat > .github/scripts/test.ts << 'EOF' | |
| export default async function run({ core, context, args }) { | |
| core.info('Test script running!'); | |
| core.info(`Context: ${context.eventName}`); | |
| core.info(`Args: ${JSON.stringify(args)}`); | |
| return { | |
| success: true, | |
| eventName: context.eventName, | |
| args | |
| }; | |
| } | |
| EOF | |
| - name: Test the action | |
| id: test | |
| uses: ./ | |
| with: | |
| ts-file: .github/scripts/test.ts | |
| args: '{"message":"Hello from test!","timestamp":"${{ github.event.head_commit.timestamp || github.run_id }}"}' | |
| - name: Verify result | |
| run: | | |
| echo "Action result: ${{ steps.test.outputs.result }}" | |
| # Parse and verify the JSON result contains expected fields | |
| echo '${{ steps.test.outputs.result }}' | jq -e '.success == true' | |
| echo '${{ steps.test.outputs.result }}' | jq -e '.eventName' | |
| echo '${{ steps.test.outputs.result }}' | jq -e '.args.message == "Hello from test!"' |